Posts Tagged ‘Screen Rotation’
December 30th, 2009 @ 7:31 pm

Word of warning before we start, this goes against the standard Android UI and should only be done when you are certain it is appropriate.
To handle screen rotations such that your activity doesn’t get destroyed and restarted do the following:
- In your AndroidManifest.xml file go to the Application tab (Assuming you are in Eclipse, Manual programmers can still use this info, but will need to work out the corresponding xml), then under Application Nodes select the Activity you want to stop the rotations on, on the right hand side under “Attributes for <Class Name> (Activity)” scroll down to Screen Orientation and set it to portrait or landscape.
- Then in the same section set config changes to “orientation|keyboardHidden”
- Now back in your class add the following function and you’ll be good to go.
// Handle Screen Orientation (Stop Activity being killed and re-started)
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
}
// Handle Screen Orientation (Stop Activity being killed and re-started)
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
}
Tags: Android, Screen Rotation
Posted in Uncategorized | No Comments »
0