Hi,
I want to store some preferences related to colors and these preferences
will be used by some activities.
What I need are background color and foreground color preferences, in the
preferences.xml file:
------------------------------------------------------------
<PreferenceScreen>
<PreferenceCategory>
<Preference
android:key="foreground_color"
?how ot set value here? />
<Preference
android:key="background_color"
?how ot set value here? />
</PreferenceCategory>
</PreferenceScreen>
------------------------------------------------------------
And in the preference activity, I want to change these preferences (I know
how to get input from users, so just list the code for changing
preferences):
------------------------------------------------------------
addPreferencesFromResource(R.xml.preferences);
// get preferences and editor
preferences = PreferenceManager.getDefaultSharedPreferences(this);
editor = preferences.edit();
Preference mBackcolor = (Preference)
findPreference("background_color");
Preference mForecolor = (Preference)
findPreference("foreground_color");
editor.// ?? how to set color here?
------------------------------------------------------------
Finally, I need get these color preferences in activities, it would be
something like:
------------------------------------------------------------
SharedPreferences preferences =
PreferenceManager.getDefaultSharedPreferences(this);
int COLOR_BACKGROUND = preferences.get// ? how to get color from
SharedPreferences?
int COLOR_FOREGROUND = preferences.get// ?
------------------------------------------------------------
I'm new to Preference Activity, I can now use it to change Strings.
I want to know if it is possible to change color preferences, and if yes,
how?
--
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