Thanks Mark. Using a database seems a bit overkill in my case. I found that I can pass the state of my object in a Bundle by making it Parcelable. I'll try that out.
On Jul 3, 10:32 pm, Mark Murphy <[email protected]> wrote: > On Sat, Jul 3, 2010 at 1:28 PM, jul <[email protected]> wrote: > > I created a RestaurantList class to hold my data (a list of some > > Restaurant objects created to get some json data using gson). How can > > I pass an instance of that class toonSaveInstanceStateto be able to > > restore my data when needed? > > You shouldn't pass an instance of that class toonSaveInstanceState(). > Your data model is not part of your instance state. > > If you are trying to deal with orientation changes, return your > RestaurantList in onRetainNonConfigurationInstance() and get it back > in onCreate() via getLastNonConfigurationInstance(). > > Otherwise (or perhaps even if orientation is your issue), move that > data out of the activity into a database, or in a pinch a Java object > mediated by a service (so it will stick around despite activities > coming and going). > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android 2.2 Programming Books:http://commonsware.com/books -- 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

