Skip to content Skip to sidebar Skip to footer

Android Shared Preferences Mcolorpicker Issue

I am trying to use the mColorPicker and have it running good, it changes the color in the picker but I am trying to get the shared preferences to get the new color so I can use it.

Solution 1:

I have used this ColorPicker and it works great.

Have a button in your preferences to show the dialog when pressed.

I use

SharedPreferencessharedPreferences= getSharedPreferences(MY_PREFERENCES, Activity.MODE_PRIVATE);
editor = sharedPreferences.edit();

and then when the user choose the color

editor.putInt(TEXT_COLOR, color);
editor.commit();

In your main activity you will get the color by

prefs = getSharedPreferences(Preferences.MY_PREFERENCES, Activity.MODE_PRIVATE);textColor = prefs.getInt(Preferences.TEXT_COLOR, R.color.black);

Hope this helps.

Post a Comment for "Android Shared Preferences Mcolorpicker Issue"