hehonghui / hehonghui/AndroidEventBus

关于 @Subscriber(tag = "my_tag",mode = ThreadMode.POST) 接收不到消息

Open
#42 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.6k
Forks
390
PR merge metrics
No merged PRs in 30d

Description

您好,看了您的博文 感觉非常受用,想跟您请教个问题,按照文档使用AndroidEventBus 发现 接收不到EventBus.getDefault().post("my_tag"); 传递过来的消息,不知如何解决,想跟您请教一二,发生这个事情问题会出现在哪?

MainActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_home);
EventBus.getDefault().register(this);
}

@Subscriber(tag = "my_tag",mode = ThreadMode.POST)
private void updateUserWithTag() {
    ToastUtils.showShort(HomeActivity.this, "Passed parameters");
}

MyActivity
//发送消息
EventBus.getDefault().post("my_tag");

看到请您能够及时回复我,谢谢~~

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the registration in MainActivity.onCreate, then compare the @Subscriber method with the EventBus.getDefault().post call in MyActivity. Reproduce the missing delivery and verify that the tag, subscriber signature, and posted message match the library's documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.