Thank for you help 2009/8/21 Dianne Hackborn <[email protected]>
> Then write it in a flat file. That works too. > > There is nothing all that special about this: your app is exiting > (finishing); you apparently want to restore some state that was saved from > the last time it run; so write it into persistent storage somewhere when you > are done and read it back when you start again. You go about this like you > would on most other platforms, and we don't have any specific special > support in Android for this particular case. > > 2009/8/20 宋庆欣 <[email protected]> > > shared preferences couldn't store array. >> >> >> 2009/8/21 Dianne Hackborn <[email protected]> >> >>> Put it in your shared preferences, put it in a raw file, whatever. >>> >>> >>> On Thu, Aug 20, 2009 at 6:04 PM, 宋庆欣 <[email protected]> wrote: >>> >>>> Have I another way to store an array between sessions? DB is too >>>> complex. >>>> >>>> >>>> 2009/8/21 Dianne Hackborn <[email protected]> >>>> >>>>> If you finish your activity, that instance is gone, so you won't get >>>>> the instance state. onSaveInstanceState is for restoring the activity to >>>>> its previous state after the user leaves it (WITHOUT finishing it) and >>>>> later >>>>> returns and it needs to be restarted. Or if the configuration changes >>>>> (rotation, keyboard visibility, locale, etc) so the current activity >>>>> instance needs to be restarted from its saved state. >>>>> >>>>> On Thu, Aug 20, 2009 at 9:12 AM, chandlersong >>>>> <[email protected]>wrote: >>>>> >>>>>> >>>>>> protected void onSaveInstanceState(Bundle outState) { >>>>>> super.onSaveInstanceState(outState); >>>>>> outState.putStringArrayList("history", >>>>>> this.history); >>>>>> >>>>>> } >>>>>> >>>>>> it's my code.and this.history is an arraylist.I hope I can get >>>>>> it at OnCreate method next time. but it doesn't work. >>>>>> I search and find that the method works only when it’s not >>>>>> being explicitly finished.Does it ture? It's mean I have to find >>>>>> another way to restore the arraylist if the app finished explicitly? >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Dianne Hackborn >>>>> Android framework engineer >>>>> [email protected] >>>>> >>>>> Note: please don't send private questions to me, as I don't have time >>>>> to provide private support, and so won't reply to such e-mails. All such >>>>> questions should be posted on public forums, where I and others can see >>>>> and >>>>> answer them. >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> -- >>> Dianne Hackborn >>> Android framework engineer >>> [email protected] >>> >>> Note: please don't send private questions to me, as I don't have time to >>> provide private support, and so won't reply to such e-mails. All such >>> questions should be posted on public forums, where I and others can see and >>> answer them. >>> >>> >>> >>> >> >> >> > > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

