views:

18

answers:

1

While testing on Android 1.6 using a G1 I have noticed that when I slide out the keyboard it kills the activity and recreates it even though I have set my activity to only display in portrait mode.

Same happens when I push the keyboard back in.

I get onSaveInstance, onDestroy called, then onCreate, onResume, OnrestoreInstance...

I understand why this is done when the display is being switched to landscape view but why does this happen when I specifically dont want my activity to switch view, its essentially killing and restarting the activity for no reason.

Is it the same on 2.x devices?

Is there something I'm missing to stop it happening?

Can anyone explain if there is any point to it?

+1  A: 

This is the recommended behavior in Android. But if you want to stop this you can specify the following property in your Manifest against your Activity

android:configChanges="keyboardHidden|orientation"
Rahul
Thanks for that Rahul, I am aware it is Android behaviour but for my particular app staying in portrait mode all the time is more natural behaviour for its use. Switching it to landscape would be very wierd for users.
Donal Rafferty