I am trying to get a color pixel from a image and then compare it with some other colors using switch case and display using toast but the problem is I am not able to match it using switch case. can any one help me. here is my code
public boolean onTouch(View v, MotionEvent event) {
int x = (int)event.getX();
int y = (int)event.getY();
int pixel = bitmap.getPixel(x,y);
switch (pixel) {
case Color.RED:
Toast.makeText(getApplicationContext(), "color", Toast.LENGTH_LONG).show();
break;
default:
Toast.makeText(getApplicationContext(), "default", Toast.LENGTH_LONG).show();
break;
}
return false;
}