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

hello,I discovered a problem,the function that eventbus.getdefault.postSticky() in BroadcastReceiver is not work,please help me,thank you #37

Open
ApeForProgram opened this issue Mar 30, 2016 · 2 comments

Comments

@ApeForProgram
Copy link

hello,I discovered a problem,the function that eventbus.getdefault.postSticky() in BroadcastReceiver is not work,please help me,thank you

@hehonghui
Copy link
Owner

is your BroadcastReceiver run in other process ?

@ApeForProgram
Copy link
Author

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

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