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:
parent
ae74d54451
commit
4dbacd79ae
@ -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
|
||||
|
@ -131,8 +131,8 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
prefs.unregisterOnSharedPreferenceChangeListener(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user