Eck, spoke too soon - for this to work, you need to have the display
values replicated somewhere in non-array form, not pretty.
On Oct 2, 9:19 pm, RoryD wrote:
> how about:
>
> SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences
> (this);
> String value = pref.getString("key",
how about:
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences
(this);
String value = pref.getString("key", "default value");
Resources r = getResources();
String localizedValue = r.getString(r.getIdentifier
(value,"string",null));
You may have to fiddle with the last 2 param
The PreferenceActivity is an almost empty class - it's the usage of
the preferences in the application that I was asking about.
On 2 окт, 17:21, "nEx.Software" wrote:
> Hmm, I was under the impression that this was being done from a
> PreferenceActivity.
>
> On Oct 2, 8:18 am, "Mark Murphy" wr
Hmm, I was under the impression that this was being done from a
PreferenceActivity.
On Oct 2, 8:18 am, "Mark Murphy" wrote:
> > Does this not work for you?
>
> > listPreference.getEntry());
>
> That only works from a PreferenceActivity. AFAIK, it does not help if you
> are looking to get the dis
> Does this not work for you?
>
> listPreference.getEntry());
That only works from a PreferenceActivity. AFAIK, it does not help if you
are looking to get the display value anywhere else.
--
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/b
Without that extra closing paren of course. :)
On Oct 2, 8:12 am, "nEx.Software"
wrote:
> Does this not work for you?
>
> listPreference.getEntry());
>
> On Oct 2, 7:40 am, Neil wrote:
>
> > That's an idea, but it's messy. I can't believe that the best way to
> > solve this is to repeat that c
Does this not work for you?
listPreference.getEntry());
On Oct 2, 7:40 am, Neil wrote:
> That's an idea, but it's messy. I can't believe that the best way to
> solve this is to repeat that chunk of code everywhere you need it. I
> could put it in some utility class, but I'm sure there must b
That's an idea, but it's messy. I can't believe that the best way to
solve this is to repeat that chunk of code everywhere you need it. I
could put it in some utility class, but I'm sure there must be a nice
neat way of doing it.
Neil
On Oct 2, 4:02 pm, "Mark Murphy" wrote:
> > Actually I ju
> Actually I just repeated what I was trying to do and realised I
> phrased my question wrong. What I meant was how do I get the selected
> (localised) value - the code I quoted gets the key as you'd expect.
Um, probably with minor difficulty. The only way off the top of my head I
can think of t
Actually I just repeated what I was trying to do and realised I
phrased my question wrong. What I meant was how do I get the selected
(localised) value - the code I quoted gets the key as you'd expect.
On Oct 2, 3:35 pm, Neil wrote:
> Yes I know that. What I meant was that I can do this
>
> S
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 Murph
> 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 th
12 matches
Mail list logo