Show the application only in portrait mode in Android

To show the app only in portrait, in the application tag of your manifest file of the application you need to add one more attribute. The attribute to show the app in portrait is,
Or if you don't want the entire application in portrait mode, only some screens(Activity) to be in portrait mode, then put the same tag,
to whichever activity you want in portrait mode. The activity tag will look like,
In activity class also, you can restrict to portrait mode by adding 
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); in the onCreate() before calling setContentview()

Popular posts from this blog

Open Gallery and get the selected image in appplication

Dismiss or Cancel dialog by swipe gesture

AlarmManager and Notification in Android