We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
OkBus.getInstance().onEvent方法在onCreate中不起作用,在点击事件中或onResume才起作用,是否是因为界面还没有加载完成的原因?
public class Main4Activity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main4); //写在这里不起作用 OkBus.getInstance().onEvent(EventTags.JUMP_TO_MAIN2); findViewById(R.id.fdfsdsfsdf).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //写在这里可以起作用
// OkBus.getInstance().onEvent(EventTags.JUMP_TO_MAIN); } }); }
@Override protected void onResume() { super.onResume(); //写在这里可以起作用 OkBus.getInstance().onEvent(EventTags.JUMP_TO_MAIN2); } @Bus(value = EventTags.JUMP_TO_MAIN2) public void get(){ Log.e("Main4Activity","aaaaaaaaaaaaaaaa"); }
}
The text was updated successfully, but these errors were encountered:
找到原因了,是因为生成的class文件的原因,register在onEvent之后的原因,应该先register再onEvent就可以了 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(2131296292); OkBus.getInstance().onEvent(1); Object var3 = null; OkBus.getInstance().register(1, (Event)this, -1); }
Sorry, something went wrong.
No branches or pull requests
OkBus.getInstance().onEvent方法在onCreate中不起作用,在点击事件中或onResume才起作用,是否是因为界面还没有加载完成的原因?
public class Main4Activity extends AppCompatActivity {
// OkBus.getInstance().onEvent(EventTags.JUMP_TO_MAIN);
}
});
}
}
The text was updated successfully, but these errors were encountered: