Skip to content Skip to sidebar Skip to footer

How Can I Use Another Color Picker Without Preferenceactivity?

I have a color picker which I use in sharedPrefereces. With the default colorpicker I managed to acheive what I want, but I noticed there is no black or white colors. http://www.yo

Solution 1:

In your own Activity, add

implementsColorPickerDialog.OnColorChangedListener

to the class declaration.

Add to your class body:

publicvoid colorChanged(String key, int color) {
        //create your SharedPreferences and your SharedPreferences.Editor here
        editor.putInt(key, color);
        editor.commit();    
    }

And in a button click listener add:

new ColorPickerDialog(this, this, DROIDS_COLOR_KEY, mPrefs.getInt(DROIDS_COLOR_KEY, DROIDS_COLOR_DEFAULT), DROIDS_COLOR_DEFAULT).show();

This should work. Let me know if you I failed to answer your question, and I'll see what I can do.

Post a Comment for "How Can I Use Another Color Picker Without Preferenceactivity?"