Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

最新版本,无法post空对象 #23

Closed
hwangjr opened this issue Jul 28, 2015 · 5 comments
Closed

最新版本,无法post空对象 #23

hwangjr opened this issue Jul 28, 2015 · 5 comments

Comments

@hwangjr
Copy link

hwangjr commented Jul 28, 2015

EventBus.getDefault().post(null, LoginEvent.TAG_EVENT);
空指针异常~~
看了下源码,里面有做类型转化。。

07-28 18:28:49.449: E/AndroidRuntime(17063): java.lang.NullPointerException
07-28 18:28:49.449: E/AndroidRuntime(17063):    at org.simple.eventbus.EventBus.post(EventBus.java:188)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at co.sihe.hongmi.fragment.settings.SettingFragment$4.onClick(SettingFragment.java:88)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.view.View.performClick(View.java:4633)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.view.View$PerformClick.run(View.java:19323)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.os.Handler.handleCallback(Handler.java:733)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.os.Handler.dispatchMessage(Handler.java:95)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.os.Looper.loop(Looper.java:157)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.app.ActivityThread.main(ActivityThread.java:5293)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at java.lang.reflect.Method.invokeNative(Native Method)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at java.lang.reflect.Method.invoke(Method.java:515)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at dalvik.system.NativeStart.main(Native Method)
@hehonghui
Copy link
Owner

一直不支持post空对象。

@hwangjr
Copy link
Author

hwangjr commented Jul 29, 2015

那我比较疑惑的就是,如果没有传对象,仅仅只是想通知的话,那不是也要自己手动构建一个对象丢过去?还是有其他更优雅的做法?

@hehonghui
Copy link
Owner

@hwangjr 需要支持空消息,我这边没有空,可以自行实现,欢迎给主仓库提交pr。

@hehonghui
Copy link
Owner

@hwangjr 这位同学实现了一下,可以试试他的这个。https://github.com/lixi0912/AndroidEventBus/tree/dev

@hwangjr
Copy link
Author

hwangjr commented Aug 25, 2015

前段时间忙项目,今天整理了并PULL给你了,OK的话可以考虑merge~~ ^-^

@hwangjr hwangjr closed this as completed Aug 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants