ActionBar, Fragment and screen rotation

In the post Tab Layout in Android with ActionBar and Fragment as dnoray wrote in his comment, there is a problem: when you rotate the screen (ctrl + F11 in the emulator) there is an overlap of the two fragments as seen in the figure.

fragment issue

For a further discussion on this topic you can read this.


Preventing the rotation of the screen in Android

To prevent rotation of the screen in Android you can use one of two statements:
Android: screenOrientation = “portrait”
Android: screenOrientation = “landscape”
being included in the activity tag in the file AndroidManifest.xml.


Keeping the Android screen on

Sometimes you prefer to keep the Android screen on also in case of prolonged inactivity, this limit is usually set at 30 seconds, beyond which the screen turns off to increase the battery life.
This can be true for applications like watching movies, navigators, or even during the development phase of an application.
To keep the screen on for a particular Activity you can use the following statement: