I had been wondering how to do this for a long time, and I had seen
some questions on this group, but no real answers.

So, here's some code I whipped up and wanted to share with fellow
devs: http://pastebin.com/f6cecdf72

Basically, instead of using views for the list options, when an item
is clicked, a state flag is enabled or disabled.  When the dialog is
closed (positive), the state is converted to a delimited string for
persistent storage (which should be fine for just about any
"preference" need).

To use the preference, the following xml attributes should be
supplied:
  => android:entries (string array ref)
  => android:key (for persistence)
  => android:entryValues (string array ref containing "true" or
"false" for entries)   >OR<
  => android:defaultValue (delimited string of numbers E.G: 0;3;5)


There's some JavaDoc included, I hope this helps anyone who was in the
same boat as I was.

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