Code for study session on Android app persistence mechanisms

36 views
Skip to first unread message

Pat Tressel

unread,
Feb 20, 2012, 5:35:55 PM2/20/12
to seattle-java-andr...@googlegroups.com
Hi, all!

This is the first version of a demo of how to save and restore Android app state:

https://github.com/ptressel/PersistenceDemo

It's the first version (with more to come) because I was off by a week on which day I was presenting.  D'oh! and Sorry!!!  This version shows use of preferences, local file, and a state object, plus most of the system callbacks used to save and restore state.

I'm going to try to get in use of a sqlite database and a bundle to complete the set of local storage options used for state persistence.

This doesn't cover external storage, as one can't count on having that, so it's not as useful for persistence.  External storage includes the SD card, writing to another machine via USB, and querying / updating to a web service.  If anyone's interested, I can put together a demo of doing authenticated queries to a web service from an app (i.e. not using a browser), treating the web service as storage, not as something to generate a UI.  (If we want, we can use the demo server for Sahana Eden as a back end -- it supports an extensive REST interface.)

Show of hands:  Is there interest in looking at any of the external storage methods?

-- Pat

Pat Tressel

unread,
Feb 20, 2012, 6:26:41 PM2/20/12
to seattle-java-andr...@googlegroups.com
Good starting points in the Android docs for app state changes and storage options are:

http://developer.android.com/reference/android/app/Activity.html
(See especially the diagram of when the various state change handling callbacks are invoked -- a picture is definitely worth many words...)

http://developer.android.com/guide/topics/data/data-storage.html

-- Pat
Reply all
Reply to author
Forward
0 new messages