Skip to content

Instantly share code, notes, and snippets.

@steveliles
Created October 20, 2013 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveliles/7076351 to your computer and use it in GitHub Desktop.
Save steveliles/7076351 to your computer and use it in GitHub Desktop.
package androidconcurrency.chapter4;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
/**
* Adds support for isChangingConfigurations when minSdkVersion
* targets api-levels below 11.
*
* Unfortunately onSaveInstanceState is invoked AFTER onPause,
* so on platforms below 11 isChangingConfigurations will only
* report correctly in onStop() or onDestroy().
*/
public class CompatibleActivity extends FragmentActivity {
private boolean isConfigChange;
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
isConfigChange = true;
}
@Override
public boolean isChangingConfigurations() {
if (android.os.Build.VERSION.SDK_INT >= 11)
return super.isChangingConfigurations();
else
return isConfigChange;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment