That is intentional.

http://developer.android.com/reference/android/app/Activity.html

"Unless you specify otherwise, a configuration change (such as a
change in screen orientation, language, input devices, etc) will cause
your current activity to be destroyed, going through the normal
activity lifecycle process of onPause(), onStop(), and onDestroy() as
appropriate. If the activity had been in the foreground or visible to
the user, once onDestroy() is called in that instance then a new
instance of the activity will be created, with whatever
savedInstanceState the previous instance had generated from
onSaveInstanceState(Bundle)."

Have a look at onSaveInstanceState and onRestoreInstanceState - you
should set your state that way.

StackOverflow has a good example of it -
http://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state.



On Jul 7, 3:40 pm, schwiz <sch...@gmail.com> wrote:
> So I finally got to the point where I was ready to deploy my app to my
> G1 and test it out and the first thing I noticed was that when I
> change my phone to landscape view my main activity restarts and resets
> all of my variables to their default settings.  How can I avoid this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to