Application crashed when orientation change - android

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.

Related

Android, landscape only view orientation - Phone and Tablet

I'm trying to create an android app with a fixed landscape orientation so I updated the manifest to include the following
activity android:name=".MainActivity"
android:screenOrientation="sensorLandscape"
This worked perfectly on a Pixel 2 phone, but when I opened the app on a Nexus 9 Tablet the orientation matched the rotation of the device as if I had done nothing.
Why is this happening and what can I do to resolve the issue?
I'm fairly novice, so please keep things simple.
cheers
Try adding
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
to your OnCreate method and see what happens

android:screenOrientation="sensorPortrait" doesn't work on API +17

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.

android:screenOrientation=“sensorPortrait" not valid?

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

Android Orientation phonegap version

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.

Camera preview is letterboxed when on portrait

I'm using the cameraPreview sample coming with the Android API demos. The problem is, the camera preview is showing properly on landscape, but when I rotate the phone to portrait, I get a letterboxed and rotated image.
I'm using Android 2.3.3 and a Samsung Galaxy Ace, but also tried 2.1 on a Xperia Mini 10 Pro.
A couple of pics (sorry for poor the quality):
portrait http://i42.tinypic.com/a9qzuu.jpg
Is this normal behavior of the demo program? What's a proper way to fix it?
This helped for me :
mCamera.setDisplayOrientation(90);
I was able to fix the problem I was having that was very similar to this. It had to do with with an old supports-screens ... / entry I had in my manifest file. I removed this from my manifest and everything worked like a charm. Hopefully this might help solve your problem. Cheers.
Solved it, turns out it was a problem with my manifest, I had to include a line defining a fixed screen orientation for the camera activity. :P

Categories

Resources