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();
Related
In android-13 devices, am facing issue with playing video within the exoplayer. when user rotates them devices video player will be set to full screen. but in this case rotating device can changes orientation but showing app in portrait mode only (whole page)
Expected: rotating device should fill the screen as like Android 12 and previous versions
Tried
android:name=".ui.fullscreenVideo.VideoPlayerActivity"
android:exported="true"
android:configChanges="orientation"
android:screenOrientation="userLandscape"
but issue not fixed (
When user rotate them mobile, video activity also want to get rotated like previous android 12 and below versions
The problem is Android-13, showing portrait screen mode in landscape orientation
We are experiencing same issue in android 13 android:screenOrientation="locked"
I changed the setting to default/nosensor to resolve the issue currently.
android:name=".MainActivity"
android:exported="false"
android:configChanges="orientation|screenSize|keyboard|locale|keyboardHidden|uiModel"
android:screenOrientation="locked"
I have game running in landscape mode. When I press lock button and then unlock again everything is OK. I also handle screen orientation changes like this:
<activity
android:configChanges="orientation|keyboard|keyboardHidden"
android:screenOrientation="portrait"
This everything works OK with one exception:
I run the game in portrait mode
press lock button
press unloc button (so I see the lock screen)
change orientation to landscape and wait while the lock screen turns
swipe lock screen to return to game
=> app is closed (no error)
Does anyone know how to handle this? How to prevent or handle screen orientation when lock screen orientation changes just before swiping unlock screen<
I believe you need 'screenSize'. Even though you handle "orientation" changes the screen size changes from X by Y to Y by X and that counts as a screen size change.
<activity
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
android:screenOrientation="portrait"
Beginning with Android 3.2 (API level 13), the "screen size" also changes when the device
switches between portrait and landscape orientation. Thus, if you want to prevent runtime
restarts due to orientation change when developing for API level 13 or higher (as declared
by the minSdkVersion and targetSdkVersion attributes), you must include the "screenSize"
value in addition to the "orientation" value. That is, you must declare
`android:configChanges="orientation|screenSize".`
However, if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device).
Source:
http://developer.android.com/guide/topics/resources/runtime-changes.html
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)
When developing the app it looks great on my virtual devices.
But when trying it on my real tablet it displays the whole app upside down!
Can I change the orientation by 180 degrees somewhere in the android settings?
Can I change my code slightly to display the app in 180 degrees?
Please note that I am using api8 (android 2.2)
You can set the screen orientation of the activity in the AndroidManifest.xml file
e.g
<activity
.
.
android:screenOrientation="reverseLandscape"
/>
You can use other options see the documentation
I realize the question is about 2.2, however this valuable piece of code (2.3+) handles both orientations of landscape inside your manifest:
android:screenOrientation="sensorLandscape"
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"
/>