If you want to disable Landscape mode for your android app ( or a single activity) all you need to do is add, android:screenOrientation="portrait" to the activity tag in AndroidManifest.xml file.
Example :
<activity android:name="YourActivityName"
android:icon="@drawable/icon"
android:label="Your App Name"
android:screenOrientation="portrait">
Now the activity YourActivityName be displayed only in portrait mode.
If you want to do this programatically ie. using Java code. You can do so by adding the below code in the Java class of the activity that you don't want to be displayed in landscape mode.
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
- appcompat_v7 errors after updates to API level 21 Material Theme
- adb: The Android Debug Bridge and Commands
- The Android Virtual Device myEmulator is currently running an emulator and cannot be deleted.
- How to make TextView Text Transparent [Android]
- Android is starting optimizing... app 1 of 1
- How to make Text in TextView bold and italic in Android
- Android Development - How to switch between two Activities
- Android : IOException: Unable to open sync connection!
- Android Toolbar example with appcompat_v7 21
- How to Change Android Title Bar Color?
- How to Add Padding to Android TextView
- JavaScript : redirect page to other url
- Programmatically Send an Email from Android App using Intent
- What is Android Toast.LENGTH_SHORT and Toast. LENGTH_LONG durations
- [Soluiton] You already have the latest version of Android Studio installed
- Detect swipes on Android Activity
- Add Buttons at the bottom of Android Layout xml file
- Android Lint app_name is not translated in af (Afrikaans) am (Amharic) ar (Arabic) bg (Bulgarian)
- Hide Navigation Bar from Android Screen Activity
- Android Disable EditText from Auto Focus on Activity load
- Toast not getting displayed Android App
- How to Enable Developers Option in Android Phones Settings
- Android : Duplicate registration for activity com.example.abc
- Android ListView turns Black or Flickers while Scrolling
- Android Studio Ctrl Shift o auto import not working
- How to Update Roblox on Mac - MacOS
- Open New tab using keyboard shortcut in Mac Terminal - Mac-OS-X
- Random CSV Data File Generator - Tools
- Fix - bash: man: command not found - Linux
- How to Auto Click Mouse on Mac every X Seconds - MacOS
- How to customize SharePoint Modern list form using JSON formatting - SharePoint
- How to install ddtrace - Datadog tracing library for Python - Python
- Run only a Single Unit Test using Gradle - Gradle