"You might want to save your variable when onPause gets called." Forgot to add, and restore it in onResume().
------------------------------------------------------------------------------------------------- TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking On Thu, Nov 19, 2009 at 10:57 AM, TreKing <treking...@gmail.com> wrote: > onSaveInstanceState gets called when you're activity is likely to be killed > off so you can restore it when it's recreated. When you open / close the > keyboard on the G1 your activity gets destroyed and recreated, triggering > the call to onSaveInstanceState. > > Pressing the Home key, however, will only pause (and stop, I think) your > Activity, it won't immediately kill it, so onSaveInstanceState is not > called. Unless it remains in the background long enough and the system > decides to kill it off later. > > You might want to save your variable when onPause gets called. > > I would recommend you look over the Android Life Cycle documentation. > Also, put log statements in each of the onCreate, onStart, onResume, > onPause, onStop, onDestroy, onSaveInstanceState, and onRetoreInstanceState, > to see what gets called on what conditions and get a better idea of what's > going on. > > > ------------------------------------------------------------------------------------------------- > TreKing - Chicago transit tracking app for Android-powered devices > http://sites.google.com/site/rezmobileapps/treking > > > > On Thu, Nov 19, 2009 at 9:18 AM, jax <jackma...@gmail.com> wrote: > >> I need to store a variable that contains my application state >> "restoredClockTime" >> >> I do this in onSaveInstanceState and onRestoreInstanceState and it >> works when I flip the screen on the G1. >> >> The problem is when I press the Home button and then re-enter the >> activity it does not work. >> >> why is 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<android-developers%2bunsubscr...@googlegroups.com> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > -- 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