Created
November 12, 2019 17:19
-
-
Save matthewmorrone/e1d620396e750ce68f1f22da5bf9bd82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setOrientation(boolean status) { | |
if (status) { | |
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED); | |
} else { | |
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); | |
} | |
} | |
// In AndroidManifest.xml just add android:screenOrientation="portrait" | |
// <activity android:name=".MyActivity" android:label="@string/app_name" android:screenOrientation="portrait"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment