Avoir the restart of the application on rotation change

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Avoir the restart of the application on rotation change

Postby nah0y » Mon Mar 23, 2009 11:27 pm

Hi !

I've search for 2-3 days on the web to find a way to avoid the restart of my activity when i open the keyboard of my G1 with no success.

Does anybody has a solution to do that, in fact, i want nothing to happen when the user open the keyboard.

Thanks !
nah0y
Developer
Developer
 
Posts: 30
Joined: Mon Jan 12, 2009 10:59 pm

Top

Postby kanzlr » Mon Mar 23, 2009 11:53 pm

hm, well, first you can implement the onConfigurationChange method provided by the Activity class and react accordingly. I have not tried to do nothing yet :) I have seperate layouts for landscape and portrait and on pause i persist the primary key of my current data set in a preference and on a configuration change i reload the data...hm.

but overload the method and see what you can do. hm. maybe you can just leave it empty?
kanzlr
Developer
Developer
 
Posts: 25
Joined: Sun Mar 15, 2009 4:44 pm
Location: Vienna/Austria/EU

Postby d80harri » Fri Mar 27, 2009 8:01 pm

Don't know if this is what you are looking for... but I've found the following in a book about android application-developement:

"[...] Android supports runtime changes to the language, location, and hardware by terminanting and restarting each application and reloading the resource values. This default behavior isnt always convenient or desirable, articularly as some configuration changes (like screen orientation and keyord visibility) can occur as easily as a user rotatint the device or sliding out the keyboard. [...]

<activity android:name=".TodoList" android:label="@string/app_name" android:theme="@style/TodoTheme" android:configChanges="orientation|keyboard"/>

Adding this attributes suppresses the restart of the specified configuration changes, instead, triggering the onConfigurationChanged method in the Activity. [...] blab bal [...] override onConfigurationChanged."

Good luck,

Harald
Des fois on n'sait pas bien ce qui s'passe.
d80harri
Freshman
Freshman
 
Posts: 2
Joined: Fri Mar 27, 2009 7:52 pm

Postby nah0y » Sat Mar 28, 2009 10:13 pm

Hi,

Thanks both of you for your answers, but those 2 things doesn't work, unfortunately.

Thanks anyway !
nah0y
Developer
Developer
 
Posts: 30
Joined: Mon Jan 12, 2009 10:59 pm

Postby Emmanuel7 » Mon Mar 30, 2009 12:44 am

This is what I'm doing to force my activity to be in portrait mode whatever the orientation or the keyboard state :

In the manifest.xml :

Code: Select all
        <activity android:name=".WordProspector"
                 android:screenOrientation="portrait"
                 android:configChanges="keyboardHidden|orientation" 
                 android:label="@string/app_name">

At least in the emulator, it's ok !

Hope it helps,
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Postby nah0y » Mon Mar 30, 2009 1:04 am

Thx so much guys !!
In fact i was using :
Code: Select all
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation


on the : <manifest xmlns:android="http://schemas.android.com/apk/res/android"
instead of using it on my activity...

Thx so much for your help !!
Have a nice day :D !
Thx !
nah0y
Developer
Developer
 
Posts: 30
Joined: Mon Jan 12, 2009 10:59 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests