Closed Nirvanatin closed 8 years ago
This is how ColorPickerDialogBuilder did it: https://github.com/QuadFlask/colorpicker/blob/2d4081c73df36d5db30b2d68712d2b44469a1eed/library/src/main/java/com/flask/colorpicker/builder/ColorPickerDialogBuilder.java#L89
public ColorPickerDialogBuilder setOnColorSelectedListener(OnColorSelectedListener onColorSelectedListener) {
colorPickerView.addOnColorSelectedListener(onColorSelectedListener);
return this;
}
I'm trying to call that method from SampleActivity2 but couldn't. Can I ask you for help with this?
@JToward How did you write the code?
I mess up with the code and gave up. Is it possible for you to write that part of the code to get the selected color and show it in a toast message in view mode? I would greatly appreciate it if you could help me. Thank you.
@JToward you can use addOnColorSelectedListener
method to get selected color.
ColorPickerView colorPickerView = (ColorPickerView) findViewById(R.id.color_picker_view);
colorPickerView.addOnColorSelectedListener(new OnColorSelectedListener() {
@Override
public void onColorSelected(int selectedColor) {
Toast.makeText(
SampleActivity2.this,
"selectedColor: " + Integer.toHexString(selectedColor).toUpperCase(),
Toast.LENGTH_SHORT).show();
}
});
I updated SampleActivity2 code, check out this
Thanks a lot.
I would appreciate it If you could help me to get the selected color in view mode (not dialog). How should I write the listener for each color which has been selected?
Thank you in advance.