Robert Green wrote:
> I'm well aware of onSaveInstanceState(Bundle b) and the corresponding
> onCreate and onRestore...
> 
> What I want to do is persist the bundle somewhere simple where I'll
> only ever have one at a time.  The functionality is to be able to
> resume a game from its previously stored state - not to be confused
> with restoring the activity during its lifecycle.  I want to restore
> it AFTER it's been destroyed (think of turning the phone on and having
> a button on the game that says, "resume last game".  My thoughts are
> that if I can just persist the bundle that I normally use for the
> instance state, then I should be able to reload it later upon user
> request.
> 
> I don't want to use a provider because they seem way too over the top
> for what I'm doing.  Anyone?
> 
> The best functionality would be
> 
> saveBundle(Bundle b)
> 
> -game menu activity-
> isThereASavedBundle()?
> Bundle b = loadBundle();
> startGameActivityWithResumeFlagOn();

Bundle implements Parcelable, so you should be able to use
writeToParcel()/readFromParcel() to get the Bundle into a Parcel, then
use Parcel's marshall() and unmarshall() to get a byte[] you can persist
to a file.

Somewhat tedious, but it should work.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Looking for Android opportunities? http://wiki.andmob.org/hado

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to