Yes I know that.  What I meant was that I can do this

SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences
(this);
String value = pref.getString("key", "default value");

And it will return the selected value.  But how do I get the selected
key?



On Oct 2, 2:06 pm, "Mark Murphy" <mmur...@commonsware.com> wrote:
> > When using a PreferenceActivity to do preferences, the
> > PreferenceScreen can contain a ListPreference.  A ListPreference has
> > an array of keys and an array of values.  But the PreferenceActivity
> > only writes the values to SharedPreferences.  How do I get the key of
> > the item selected from the list?  I would have thought this is pretty
> > fundamental, especially if you want to translate your app.
>
> ListPreference takes two string arrays. The first string array is what the
> user sees, and that you would localize. The second string array is what
> gets stored in the SharedPreferences, and that you would not localize.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> Android App Developer Books:http://commonsware.com/books.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to