How to set individual colors in the Activity in android?

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?

Answers


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;
    }

}

Need Your Help

How to format a number value in AngularJS ui-grid cell to two decimal?

angularjs angularjs-directive number-formatting angular-ui-grid

I'm using Angularjs ui-grid and using the default settings, the question is how can I format the numbers to two decimal?

Cannot override h2 properties in CSS

css

Can anyone tell me where I'm going wrong here, I've positioned paragraphs and headings easily before but for some reason cannot move the paragraph 'After taking to the walking trails...' up closer ...