Try this:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
//Do your operation
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
More Related Contents:
- Android app crashes when value is not found
- How to manually include external aar package using Gradle for Android
- how to make surfaceview transparent
- How to detect swipe direction between left/right and up/down
- LinearLayout not expanding inside a ScrollView
- Android CalendarView for Showing Events
- Android Studio – Android Emulator Wifi Connected with No Internet
- Is there any limit of bundle in Android?
- Remove application icon and title from Honeycomb action bar
- Does the Android ART runtime have the same method limit limitations as Dalvik?
- Naming my application in android
- Android: Volley HTTP Request custom header
- How to add external fonts to android application
- How do I build a native (command line) executable to run on Android?
- How to Measure TextView Height Based on Device Width and Font Size?
- AsyncTask, must it take such a performance penalty hit…?
- How to keep the OAuth consumer secret safe, and how to react when it’s compromised?
- Android UI Design: Supporting Multiple Screens
- How to build OpenSSL as unversioned shared lib for Android?
- How do I adb pull ALL files of a folder present in SD Card
- Share application “link” in Android
- Execute shell script in Gradle
- Is there any way to get key hash from signed APK?
- Failed to load map. Error contacting Google servers issue with android google maps api v2 [duplicate]
- AppWidgetHostView can’t handle onClick/onLongClick properly
- Manually adding aar with dependency pom/iml file
- Fragment view in ViewPager is not restored when resuming
- Hex colors in Android are sometimes eight digits. How? What is the difference between #FFFFFF and #FFFFFF00?
- ERROR No package identifier when getting value for resource number
- Is there any way to force audio through the speakers when headphones are plugged in?