Tablet devices loading wrong orientation - android

My app only uses one page which is the main activity and in the manifest it is set not to allow rotation hence the orientation stays the same wether or not you rotate the device. however on tablets when a user is in landscape orientation and runs the app. the app loads the default orientation (Portrait) but in a landscape view instead and im seeing only half the screen.
help.
This is part of my activity in manifest i use nosensor to disable rotation.
<activity
android:name="com.paul.xicon.MainActivity"
android:windowSoftInputMode="adjustPan"
android:label="#string/app_name"
android:screenOrientation="nosensor">

I'm not sure how are you disabling the screen rotation. But this should work just fine in your activity tag of manifest.
android:screenOrientation="landscape" (disables the screen-rotation & restricts to landscape mode)
or,
android:screenOrientation="portrait" (disables the screen-rotation & restricts to portrait mode)

Related

Samsung Tab S2 not respecting manifest screenOrientation

I have an Activity that is meant to be displayed in landscape. Ideally I want to support either direction of landscape. In my manifest I've set this on my Activity:
android:screenOrientation="sensorLandscape"
Which has worked fine in all my experience in the past. But this device seems to decide sometimes that portrait orientation is allowed. It will rotate to all 4 orientations (landscape/reverseLandscape, and portrait/reversePortrait).
If I set it like this:
android:screenOrientation="landscape"
it works correctly. Also if I disable screen rotation then it works correctly. However both of these options leave me with no reverseLandscape.
I've also tried requesting the orientation to be set in Java code:
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
This does not seem to make any difference in the behavior.
Is this a known issue on Samsung devices? and is there any workaround to get the device to respect my sensorLandscape orientation setting?

How to remember last screen orientation setting in android

I have a android 6.0.1 tablet. My activity is here using following orientation settings:
<activity
android:name=".MainActivity"
android:screenOrientation="sensorLandscape"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize|stateHidden"
android:configChanges="keyboardHidden|orientation|screenSize|uiMode">
When i turn tablet into 180 degree application activity rotate but problem is that when i turn on and off screen using power button on tablet while tablet is in 180 degree, application took few second to rotate. This was not happing in older android version. Is there any android activity setting which i can use to keep remember last screen orientation and keep it same either tablet screen turn off and on ?
Simply use this in onCreate of your activity to disable rotation of activity when screen turn on and off:
((KeyguardManager)getSystemService("keyguard")).newKeyguardLock("keyguard").disableKeyguard();

Configuring screen orientation on Android

I am developing an Android app with Cordova, I use this line in AndroidManifest.xml in order to force a landscape:
android:screenOrientation="landscape"
And it works, but the problem when you flip your phone over 180* the landscape will stay reverse, like this:
Make it android:screenOrientation="sensorLandscape" instead.

I want my android application in landscape and portrait mode only?

I am developing one camera application.I want my application should be in landscape and portrait only.If mobile changes to reverse landscape, application should remain in portrait or landscape mode.And one thing is if device rotated to landscape application should change to landscape, and device changes to portrait, application changes to portrait.
If you want Potrait Mode then:
<activity android:name=".ActivityName" android:screenOrientation="portrait" />
If you want Landscape Mode then:
<activity android:name=".ActivityName" android:screenOrientation="landscape" />
You can use android:screenOrientation= locked on android manifest.
See: http://developer.android.com/guide/topics/manifest/activity-element.html for more info

Locked landscape orientation on tablet + activity started when device in portrait = visible rotation on screen

I have an activity with locked orientation (setRequestedOrientation in OnCreate). It works fine on the phone and almost fine on the tablet.
The problem I have is with honeycomb tablets (motorola xoom and samsung), when activity is started when the user holds the device in portait mode, the activity is initially displayed in portait and then after a fraction of a second it rotates to landscape. Is there any way to stop it from happening?
Try to preset it in AndroidManifest.xml:
<activity android:name=".MyActivity"
...
android:screenOrientation="landscape"
/>

Categories

Resources