How to force the Paiagem / Landscape position in my activity to always activate and lock the Portrait / Portrait position. I want my application to start in landscape position and not be able to turn to portrait position.
How to force the Paiagem / Landscape position in my activity to always activate and lock the Portrait / Portrait position. I want my application to start in landscape position and not be able to turn to portrait position.
In your activity you need to put the following code in the onCreate method:
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE);
Looking like this:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sua_activity);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE);
Hello, this can also be done in AndroidManifest, not needing to do in the code:
<activity
android:name="..."
android:label=".."
android:configChanges="orientation"
android:screenOrientation="portrait">