hello,I discovered a problem,the function that eventbus.getdefault.postSticky() in BroadcastReceiver is not work,please help me,thank you
hello,I discovered a problem,the function that eventbus.getdefault.postSticky() in BroadcastReceiver is not work,please help me,thank you
is your BroadcastReceiver run in other process ?
I solved the problem,but the other one is coming,at the same activity,I call functions include EventBus().getDefault().registerSticky(this) and EventBus.getDefault.postSticky(msg) ,the function noted by @Subscriber will work,ok or not ? The msg I post is a java bean, this is the java bean: public class PWDEventBusMsg implements Serializable{ public boolean b ; public String detail;
public PWDEventBusMsg(boolean b, String detail){
this.b = b;
this.detail = detail;
}
public String getDetail(){
return getDetail();
}
public boolean getMsg(){
return b;
}
}
And the ide prints logs are:
04-07 15:50:05.388 26364-26364/com.lhwh.lehuaonego W/System.err: at com.lhwh.lehuaonego.bean.PWDEventBusMsg.getDetail(PWDEventBusMsg.java:18)
04-07 15:50:05.388 26364-26364/com.lhwh.lehuaonego W/System.err: at com.lhwh.lehuaonego.activity.ForgetPosswordActivity.onEventMainThread(ForgetPosswordActivity.java:272)
the function noted by @Subscriber : @Subscriber public void onEventMainThread(PWDEventBusMsg msg) { if (msg.getMsg()) { initRequest(); } else { MyToast.show(getApplicationContext(), msg.getDetail()); } }
The corresponding codes are:
line 18: At class named PWDEventBusMsg , return getDetail();
line 272: At the function noted by @Subscriber ,
MyToast.show(getApplicationContext(), msg.getDetail());
Thanks