skydoves / ColorPickerPreference

🎨 A library that lets you implement ColorPicker, ColorPickerDialog, ColorPickerPreference.
Apache License 2.0
480 stars 51 forks source link

Set color programatically #23

Closed cyberdynesoftware closed 4 years ago

cyberdynesoftware commented 4 years ago

I have a ColorPickerPreference and I would like to set a color to it programatically. Unfortunately, I did not find an option to do so.

I tried to set the new color via SharedPreferences.Editor; this basically works, but the color preview is not updated. (After closing the Preferences and navigating back to them the color preview is updated, of course.)

What I'm trying to do is to reset the color to it's default value and the Preference to do so is right below the ColorPickerPreference.

skydoves commented 4 years ago

Hi, I'm not sure but you can implement it using the below way.

colorPickerView.setInitiaiColor(myColor)