I need to limit my app to displaying in portrait mode.
Using android:screenOrientation=“Portrait" works great but I'd like to have the display change to reverse portrait when the device is rotated.
Using android:screenOrientation="sensorPortrait" results in a compile error.
Funny thing though, if I use "sensorLandscape" instead it compiles fine but it's not what I need.
I'm using Eclipse v 3.7.2 with Android 2.3.3
Any ideas???
Thanks
Rob
Google has made a typo, use sensorPortait
Related
I'm working on a libGDX application and based on this question I'm forcing portrait orientation in activity tag of AndroidManifest.xml like this:
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
This used to work fine on my devices until my Samsung Galaxy S4 got upgraded to Lollipop (5.0.1) from KitKat. Now it doesn't work on this device, while still working on others (with lower Android versions). On the S4 it just displays the application in landscape, ignoring rotation.
I was looking for differences in the 5.0 API that could explain this, but couldn't find anything.
Edit: I've just tried exporting my app to .apk and it displayed properly. Previously I was running it from Eclipse debug mode. It shouldn't be hard to pinpoint the issue, but I don't have time to investigate it at the moment.
Edit2: I've just tried running it from Eclipse on a different machine, where I have API 21 (so Lollipop) and it worked. However my working .apk has been exported on another machine, where I have API 20. It's really puzzling me. Might be something related to Android plugin versions, but I'm not sure if I will be able to pinpoint it.
try
android:screenOrientation="sensorPortrait"
I am not sure what your API level. But there was a google bug around this issue, which was fixed by API 16. If you are using anything earlier and if above line does not work, try
android:screenOrientation="sensorPortait"
instead.
I want my application to work in Portrait & reversePortrait mode .. In other words, I want it to work in portrait and make it rotatable 180 degrees!
I'm using the following code within <activity> tag of the MainActivity in the Manifest.
android:screenOrientation="sensorPortrait"
However, this seems to work only on Android 4.1.2 and backward.
It doesn't work on Android 4.2.2 and above!
I tried on different phones, the same result! How to solve it?
I'm aware of a typo error by Google that replaced sensorPortrait by sensorPortait at some point.
Not sure if that is your case, but depending on your targetApi, it might.
Use sensorPortait and see what happens at compilation.
This has been fixed in API 16.
I'm making an Android app using Eclipse, phonegap (version 2.1.0) and html5.
I'm encountering a problem with the orientation of the app. When I rotate the mobile, on landscape mode, the app crashes. I looked to the other posts and applied the methode that seems to work for others (e.g android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale") but the app continue to crash.
And when I try this : android:configChanges="orientation|keyboardHidden" , the app doesn't crash in landscape mode but don't come back to portait mode!
My minimum required version is android 2.3.3 for the app.
Does anyone have already encoutered this problem and solve it for Android 2.3.3? I'm kind lost and don't know what other solution to test.
Thanks
Kraken
UPDATE: Something I forgot to say is that I'm working only on the emulator. I don't have a device with android 2.3.3 so that I could test my app.
Make sure that for all of your activities you set at least the below code:
Do you have a splash screen maybe that doesnt have it or an admob or other advertisement view on it?
<activity android:name="main" android:launchMode="standard" android:configChanges="orientation|keyboardHidden"></activity>
Also make sure that you save your instance when rotating in your webview like described in this post: Android WebView: handling orientation changes
If it then still crashes please provide some log file to show the error it is having.
Actually my problem is the same as the question posted in :
the same problem
But there is no answer yet..
Here is the problem I got :
I've just built an application using sencha touch & phone gap. It runs well on my galaxy tab but when I rotate it to portrait or landscape, it is going crash.
I have added :
android:configChanges="orientation|keyboardHidden"
on my manifest file but it is still going crash when I rotate it.
I don't know how could this happen.
Could someone help me?
Note :
I'm using
- Galaxy tab
- Sencha-touch 1.1
- Phone gap 1.2
You should have
android:configChanges="keyboardHidden|orientation|screenLayout"
instead of
android:configChanges="orientation|keyboardHidden"
to your activity in the manifest
Might be a bit late... but since I've recently been trying this, I found that specifying
android:configChanges="orientation|screenSize|keyboardHidden"
works where as
android:configChanges="keyboardHidden|orientation|screenLayout"
does NOT.
I'm using cordova 2.0.0.
I have developed camera application using SurfaceView. It captures image and saves to the sdcard. In 2.1 and 2.2 it works fine but in 2.3 onwards it gives problem.
The exact problem in 2.3 is when I open my camera I am able to see preview in portrait mode but when image is saved its in landscape mode.
I dont know why this is happening? The application works fine in 2.1 and 2.2. If I take picture in portrait mode it saves in portrait only.
waiting for replies.
Thanks in advance.
I've had a similar problem.
Looks like the SDK has some breaking changes.
Try using the setDisplayOrientation, it solved my problem, hopefully, it will help you.
Good luck.