Skip to main content

Android Lwuit app shutting down on screen re-orientation.

8 replies [Last post]
lwuitnewb
Offline
Joined: 2010-05-10

Hi all. I've searched the forum but I can't seem to find any help regarding the screen orientation in the android port of lwuit. In the readme it tells me to add android:configChanges="orientation" to the manifest so I've done that. I then override

public void onConfigurationChanged(Configuration newConfig){

}

The readme says that by adding the configChanges, onConfigurationChanged(Configuration) will be called instead of onDestroy() during the screen orientation change. However that's not what I'm seeing. onDestroy is still called which calls the shootself which kills the process. Breakpoints set in onConfiguarationChanged are never hit. Can anyone shine a little light on this for me?

Thanks in advance.
Mark

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
lwuitnewb
Offline
Joined: 2010-05-10

Your app worked fine. I started thinking maybe it's the support screen node. I don't have that and I don't seem to be able to put it into my manifest. Perhaps I'm not using the correct api version.

thorsten_s
Offline
Joined: 2008-08-15

The screen stuff is something that they added in a later SDK version. I would try to go for the [code]
[/code] combination. Version 4 indicates that you build with a newer SDK that has the right karma or something. Maybe adjust the version number from four to whatever matches your SDK. Using version >= four you should be able to add the screen stuff. And who knows, maybe it starts working :)

lwuitnewb
Offline
Joined: 2010-05-10

So I've figured out how to get my sdk working correctly so it'll actually accept the components we talked about in the manifest. My manifest now looks like bellow. Seems to look alot like yours. I'm still not getting the configuration change event and ondestroy() is being called. Any more suggestions would be welcomed. Thanks again.


package="com.seregon"
android:versionCode="1"
android:versionName="3.1.3187">


android:label="@string/app_name" android:configChanges="orientation" >







android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />

thorsten_s
Offline
Joined: 2008-08-15

I am pretty sure that this is unrelated to the lwuit implementation. Having said that, I would be very interested to know why it behaves as it does in your case. I did google a little and found a hint that an orientation change on the emulator also opens the keyboard at the same time. Your file does not catch the keyboard change. Any chance you are testing this on the emulator?

see here:
http://groups.google.com/group/android-developers/browse_thread/thread/5...

lwuitnewb
Offline
Joined: 2010-05-10

And there we have it. Must have the keyboardHidden flag in the configurationChange node. Wow what a pain this has been. Thanks alot Thorsten.

lwuitnewb
Offline
Joined: 2010-05-10

Hi Thorsten thanks for getting back to me.
Here's a copy of my manifest. does the fact that I'm not mentioning the keyboard have anything to do with it? I wouldn't think so. As you can see it's very similar although maybe a little less complex.


package="com.seregon"
android:versionCode="1"
android:versionName="3.1.3187">

android:label="@string/app_name" android:configChanges="orientation">




thorsten_s
Offline
Joined: 2008-08-15

Very strange, I have no idea. But I am far from being an Android expert. If you install the following test app, does it quit the app on rotation change, too?
http://www.pader-sync.com/LWUITList2.apk

thorsten_s
Offline
Joined: 2008-08-15

That sounds strange. Here is a sample manifest xml file, just to make sure that the configchange property is at the correct position. (I used the following file in a build today and it works fine for me)

[code]

package="net.java.lwuit.demo.searchlist2" android:versionCode="1" android:versionName="1.0.0">


android:process=":LWUITSearchListActivity2" android:configChanges="keyboardHidden|orientation"
android:windowSoftInputMode="stateUnchanged|adjustResize">






android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />

[/code]