Conditional restart on Activity onConfigurationChanged
Posted
by yuku
on Stack Overflow
See other posts from Stack Overflow
or by yuku
Published on 2010-03-19T07:28:37Z
Indexed on
2010/03/19
7:31 UTC
Read the original article
Hit count: 512
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 to I restart this activity?
} else {
// don't do anything
}
}
© Stack Overflow or respective owner