Skip to content

Instantly share code, notes, and snippets.

@topgenorth
Created July 20, 2012 22:07
Show Gist options
  • Save topgenorth/3153595 to your computer and use it in GitHub Desktop.
Save topgenorth/3153595 to your computer and use it in GitHub Desktop.
private boolean isConfigurationChanging = false; // instance variable on the activity
@Override
public Object onRetainNonConfigurationInstance() {
isConfigurationChanging=true;
}
@Override
public void onStop() {
// Could also be onDestroy();
super.onStop();
if (!isConfigurationChanging) {
getApplicationContext().unbindService(state);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment