Question

I'm trying to add a ColorPicker to my app. I see a lot a of ColorPickers (the one frome the API'S Samples, the one from Cyanogen, the AmbilWarna library, the HoloColorPicker, and the ColorPickerPreference). I think that the best for my app is the last one, but I don't need to use it on a preference.

So, what I want is to use this library inside my project when I click a button, and then take the resulting code from the SharedPreferences(I think, I don't know it), and use that color as I want for my app.

I try to use only some of the classes (only ColorPickerDialog, ColorPickerView, ColorPickerPanelView and AlphaPatternDrawable) and then I think that I have to do:

ColorPickerDialog dialog = new ColorPickerDialog(Main.this, Color.BLACK);
dialog.show();

And now I don't know how can I have the selected color.

Also I added to my project the xml view.

Any idea?

Was it helpful?

Solution

To know what is the selected color you need to to:

color=dialog.getfinalColor();

So, I think that the problem was easy to solve it. But now the problem is find a listener to detect when the dialog is closed and then to save the variable "color".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top