thanks I have made the changes your link suggests, and my app is working as expected when I switch from portrait to landscape, but now when I switch back to portrait it forcecloses. The logcat is spitting out all kinds of errors when this happen, most notability one that says android.view.WindowLeaked: activity name has leaked window com.android.internal.policy.impl.phonewin...@decorview@437af970 that was originally added here
and another one that says java.lang.IllegalArgumentException: View not attached to window manager any idea why this is happening? On Jul 7, 2:49 pm, Charlie Collins <[email protected]> wrote: > 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-ap.... > > On Jul 7, 3:40 pm, schwiz <[email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

