In this simple tip, I am going to show how to stop activity restart when rotating/changing orientation in android device and emulator. By default in android while rotating the screen, the activity gets automatically restarted. So, following example shows you how to prevent/solved it.

How to Make Android TextView Text Selectable
How to Use Font Awesome Icons in Android Application
How to Increase the Integer Value When Screen is Touched

To stop restarting android activity you have to add a line in AndroidManifest.xml file of android project.

Android Example: How to Stop Activity Restart on Rotation

XML Layout File


Java Activity File


AndroidManifest.xml File


Android Example: How to Stop Activity Restart on Rotation

Now, run your Stop Activity Restart on Rotation application and type any word in edit box and rotate your device screen.

Post a Comment

Powered by Blogger.