I want to make an activity that allows orientation changes on some condition, but not otherwise. More exactly I want to prevent restarting the activity when a background thread is busy.
I have put the configChanges
attribute on the activity manifest, and onConfigurationChanged
is called when the orientation changes. However I want to allow the app to change the orientation when allowed.
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (orientationChangeAllowed) {
// how do I restart this activity?
} else {
// don't do anything
}
}