I have problem with Eventbus with following symptoms. I have activity which starts another activity. There is used Eventbus and boolean value set. This value is changed during activity run. For first run is all ok, but in second run, I got bad value changed in previous run. Here is code:
public class ListArchiveTabs extends FragmentActivity {
private boolean isStartFragment = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isStartFragment = true;
EventBus.getDefault().registerSticky(this);
System.out.println("Create archive activity " + isStartFragment);
}
@Override
public void onDestroy()
{
super.onDestroy();
EventBus.getDefault().unregister(this);
System.out.println("Destroy archive activity");
}
public void onEventMainThread(GetArchiveEvent event)
{
if(isStartFragment == true) {
isStartFragment = false;
} else {
}
}
}
In first run is isStartFragment true, but other runs shows false.