1

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.

Kraken
  • 13
  • 4
  • First of all, did you check where it crashes? Can you show some code? You have wrote "app ... don't come back to portrait mode". This means you are doing some terrible things which have hi impact on this issue. – Marek R Sep 28 '12 at 08:52
  • Well, it crash since the moment you rotate your screen from portrait to landscape mode. I can show you more code but I simply add the lines that I paste in my first post in the activity tag, in my androidmanifest.xml located in my eclipse project. Concerning the page code itself, it's a simple white page written in html5 whith hello world written on it! What's incredible is that if I try the same code but for android 4.0.3 I works like a charm (portrait/landscape mode) – Kraken Sep 28 '12 at 09:31

1 Answers1

1

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.

Community
  • 1
  • 1
SunnySonic
  • 1,318
  • 11
  • 37
  • I tried with your code in my activity tag and it doesn't crash anymore with this code. However, the problem stays that once in landscape mode, the app stays that way and can't seem to come back in portrait mode. I checked the link provided, and applied some code provided in the other post but nothing seems to work! What's "funny" is that if I apply the code in android 4.0.3 (I made a new project android 4.0.3) everything seems to work. I wondering if the problem don't come from android version 2.3.3. – Kraken Sep 28 '12 at 09:42
  • 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. – Kraken Sep 28 '12 at 10:02
  • Well, it looks like the problem landscape mode to portrait mode seems to be related to the android emulator version 2.3 itself. I found the post of this guys talking about the problem: http://code.google.com/p/android/issues/detail?id=13189 – Kraken Sep 28 '12 at 10:37
  • Ok, I confirm that the code provided by SunnySonic is fonctionnal and that the problem related with the fact that the app stays in landscape mode is related to the android emulator 2.3. So I mark my question as answered with the solution of SunnySonic. Many thanks to the people that reply to my problem – Kraken Sep 28 '12 at 11:29