{"action":"created","issue":{"url":"https://api.github.com/repos/square/otto/issues/158","repository_url":"https://api.github.com/repos/square/otto","labels_url":"https://api.github.com/repos/square/otto/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/square/otto/issues/158/comments","events_url":"https://api.github.com/repos/square/otto/issues/158/events","html_url":"https://github.com/square/otto/issues/158","id":93764748,"node_id":"MDU6SXNzdWU5Mzc2NDc0OA==","number":158,"title":"event problem","user":{"login":"htoooth","id":1717023,"node_id":"MDQ6VXNlcjE3MTcwMjM=","avatar_url":"https://avatars3.githubusercontent.com/u/1717023?v=4","gravatar_id":"","url":"https://api.github.com/users/htoooth","html_url":"https://github.com/htoooth","followers_url":"https://api.github.com/users/htoooth/followers","following_url":"https://api.github.com/users/htoooth/following{/other_user}","gists_url":"https://api.github.com/users/htoooth/gists{/gist_id}","starred_url":"https://api.github.com/users/htoooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htoooth/subscriptions","organizations_url":"https://api.github.com/users/htoooth/orgs","repos_url":"https://api.github.com/users/htoooth/repos","events_url":"https://api.github.com/users/htoooth/events{/privacy}","received_events_url":"https://api.github.com/users/htoooth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2015-07-08T11:13:38Z","updated_at":"2018-10-19T12:14:30Z","closed_at":null,"author_association":"NONE","body":"I want to use otto in different activity.\nI write some code:\n\n```\npublic class MainActivity extends ActionBarActivity {\n\n    @Bind(R.id.name)\n    TextView name;\n\n    public static final float DEFAULT_LAT = 40.440866f;\n    public static final float DEFAULT_LON = -79.994085f;\n    private static final float OFFSET = 0.1f;\n    private static final Random RANDOM = new Random();\n\n\n    public static float lastLatitude = DEFAULT_LAT;\n    public static float lastLongitude = DEFAULT_LON;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        ButterKnife.bind(this);\n    }\n\n    @OnClick(R.id.button)\n    public void SayHi(Button button){\n\n        BusProvider.getInstance().post(new LocationClearEvent());\n\n        lastLatitude = DEFAULT_LAT;\n        lastLongitude = DEFAULT_LON;\n        BusProvider.getInstance().post(produceLocationEvent());\n\n        button.setText(\"hi\");\n    }\n\n    @OnClick(R.id.change)\n    public void ChangeLocation(){\n        lastLatitude += (RANDOM.nextFloat() * OFFSET *2) -OFFSET;\n        lastLongitude += (RANDOM.nextFloat() * OFFSET *2) -OFFSET;\n        BusProvider.getInstance().post(produceLocationEvent());\n    }\n\n    @OnClick(R.id.view)\n    public void changeView() {\n        Intent intent = new Intent(this,MainActivity2Activity.class);\n        startActivity(intent);\n    }\n\n    @Override protected void onResume() {\n        super.onResume();\n\n        // Register ourselves so that we can provide the initial value.\n        BusProvider.getInstance().register(this);\n    }\n\n    @Override protected void onPause() {\n        super.onPause();\n\n\n        // Always unregister when an object no longer should be on the bus.\n        BusProvider.getInstance().unregister(this);\n    }\n\n\n    @Produce\n    static public LocationChangedEvent produceLocationEvent() {\n        // Provide an initial value for location based on the last known position.\n        return new LocationChangedEvent(lastLatitude, lastLongitude);\n    }\n\n    @Subscribe\n    public void listenLocation(LocationChangedEvent event){\n        Log.i(\"main\", event.toString());\n    }\n```\n\nSecond Activity:\n\n```\npublic class MainActivity2Activity extends ActionBarActivity {\n\n    @Bind(R.id.location)\n    TextView change;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main_activity2);\n        BusProvider.getInstance().register(this);\n    }\n\n    @Subscribe\n    public void onLocationChanged2(LocationChangedEvent event){\n        if(event == null) Log.i(\"null\",\"event is null\");\n        Log.i(\"location change\", event.toString());\n        change.setText(event.toString());\n    }\n\n\n    @Override\n    protected void onResume() {\n        super.onResume();\n        BusProvider.getInstance().register(this);\n    }\n\n    @Produce\n    public LocationChangedEvent voichang(){\n        LocationChangedEvent a = new LocationChangedEvent(1.1f,1.1f);\n        return a;\n    }\n\n    @Override\n    protected void onPause() {\n        super.onPause();\n        BusProvider.getInstance().unregister(this);\n    }\n}\n```\n\nWhen i start second activity. there is an error happened.\n\n```\n07-08 10:50:44.666  23212-23212/com.pp.kpm.test W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa6270288)\n07-08 10:50:44.666  23212-23212/com.pp.kpm.test E/AndroidRuntime﹕ FATAL EXCEPTION: main\n    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pathprint.kpm.test/com.pathprint.kpm.test.MainActivity2Activity}: java.lang.RuntimeException: Could not dispatch event: class com.pathprint.kpm.test.LocationChangedEvent to handler [EventHandler public void com.pathprint.kpm.test.MainActivity2Activity.onLocationChanged2(com.pathprint.kpm.test.LocationChangedEvent)]: null\n            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)\n            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)\n            at android.app.ActivityThread.access$600(ActivityThread.java:130)\n            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)\n            at android.os.Handler.dispatchMessage(Handler.java:99)\n            at android.os.Looper.loop(Looper.java:137)\n            at android.app.ActivityThread.main(ActivityThread.java:4745)\n            at java.lang.reflect.Method.invokeNative(Native Method)\n            at java.lang.reflect.Method.invoke(Method.java:511)\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)\n            at dalvik.system.NativeStart.main(Native Method)\n```\n\nI don't know why?\n"},"comment":{"url":"https://api.github.com/repos/square/otto/issues/comments/431342910","html_url":"https://github.com/square/otto/issues/158#issuecomment-431342910","issue_url":"https://api.github.com/repos/square/otto/issues/158","id":431342910,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTM0MjkxMA==","user":{"login":"ManoyloK","id":15017625,"node_id":"MDQ6VXNlcjE1MDE3NjI1","avatar_url":"https://avatars2.githubusercontent.com/u/15017625?v=4","gravatar_id":"","url":"https://api.github.com/users/ManoyloK","html_url":"https://github.com/ManoyloK","followers_url":"https://api.github.com/users/ManoyloK/followers","following_url":"https://api.github.com/users/ManoyloK/following{/other_user}","gists_url":"https://api.github.com/users/ManoyloK/gists{/gist_id}","starred_url":"https://api.github.com/users/ManoyloK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManoyloK/subscriptions","organizations_url":"https://api.github.com/users/ManoyloK/orgs","repos_url":"https://api.github.com/users/ManoyloK/repos","events_url":"https://api.github.com/users/ManoyloK/events{/privacy}","received_events_url":"https://api.github.com/users/ManoyloK/received_events","type":"User","site_admin":false},"created_at":"2018-10-19T12:14:30Z","updated_at":"2018-10-19T12:14:30Z","author_association":"NONE","body":"I seems like your TextView change = null, try  BusProvider.getInstance().register(this) in onViewCreated"}}
{"actor":{"display_login":"ManoyloK"}}