Reputation: 353
I am working on paint application .I am using a colorpickerdialog for picking colors and it is also working fine .Now I am trying to fix only three colors (red,blue,green) in the Activity.
How can I fix three colors in the Activity?
This image consists of more colors in the same activity.This is what I am looking for could anyone help me how to do this or give any same program for this?
Upvotes: 1
Views: 68
Reputation: 17401
Have three TextViews with Red, Green and Blue in your activity set onClick listener for all of them and in onClick:
int currentColor=Color.RED;
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.red:
currentColor=Color.RED;
break;
case R.id.green:
currentColor=Color.GREEN;
break;
case R.id.blue:
currentColor=Color.BLUE;
break;
default:
break;
}
}
Upvotes: 1