How To Switch To Other Activity At Orientation Change (and Then Back Again)?
In my Android application I have a main activity 'MyActivity' which overrides onConfigurationChanged() method. Within that method I check for a change in the orientation, if change
Solution 1:
Why not do what the error suggests? If you move the call to the super class outside of your if-statement your app won't crash on the second orientation change.
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
{
startActivity(new Intent(this, BaseFullScreenActivity.class));
}
}
Solution 2:
As Sam stated, the super() call should be the first statement in your method. (http://developer.android.com/training/basics/activity-lifecycle/pausing.html)
Post a Comment for "How To Switch To Other Activity At Orientation Change (and Then Back Again)?"