Matching event [un]registering, call super at the end of onPause/onDestroy

Event unregistered in onDestroy() should be registered in onCreate() to
avoid being registered multiple times.
This commit is contained in:
tonymanou 2017-01-12 00:51:44 +01:00 committed by topjohnwu
parent ae74d54451
commit 4dbacd79ae
2 changed files with 4 additions and 4 deletions

View File

@ -92,13 +92,13 @@ public class MainActivity extends AppCompatActivity
}
navigationView.setNavigationItemSelectedListener(this);
CallbackHandler.register(recreate, this);
}
@Override
protected void onResume() {
super.onResume();
CallbackHandler.register(StatusFragment.updateCheckDone, this);
CallbackHandler.register(recreate, this);
if (StatusFragment.updateCheckDone.isTriggered) {
onTrigger(StatusFragment.updateCheckDone);
}
@ -107,14 +107,14 @@ public class MainActivity extends AppCompatActivity
@Override
protected void onPause() {
super.onPause();
CallbackHandler.unRegister(StatusFragment.updateCheckDone, this);
super.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
CallbackHandler.unRegister(recreate, this);
super.onDestroy();
}
@Override

View File

@ -131,8 +131,8 @@ public class SettingsActivity extends AppCompatActivity {
@Override
public void onDestroy() {
super.onDestroy();
prefs.unregisterOnSharedPreferenceChangeListener(this);
super.onDestroy();
}
@Override