android: using listpreference and retrieving key string...
Posted
by Allan
on Stack Overflow
See other posts from Stack Overflow
or by Allan
Published on 2010-03-23T14:03:40Z
Indexed on
2010/03/23
14:43 UTC
Read the original article
Hit count: 529
android
|android-preferences
I have a settings menu that pops up and in it is a listpreference type menu. It is associated with a settings.xml file where there are 'array-strings' within it. It all works good but I don't know how to retrieve the users preference.
As an example, let's say the user picks a color (red, green, or blue). The list that I've made within my 'array-strings' contain the text red, green, and blue. Within my code, I would like to do something if the user has choosen red, something else if they choose blue, etc., etc. Would I use a 'case' statement or an 'if' statement? And most importantly, how would I retrieve the users preference - the key? (am I checking for a boolean?)
Help would be appreciated...thank you...
© Stack Overflow or respective owner