Is there a way to get color of a pixel say (x,y) and check if its red and if it is red then send a touch event.
I want it to run in background and it should always be ch
You can get values from the following example.
final Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap();
imageView.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event){
int x = (int)event.getX();
int y = (int)event.getY();
int pixel = bitmap.getPixel(x,y);
int red = Color.red(pixel);
int blue = Color.blue(pixel);
int green = Color.green(pixel);
return false;
}
});