Im trying to get the color of the touched pixel and set this color as a backgroundcolor to a FrameLayout, but it doesnt work. why?
Here is my code:
@Override
public boolean onTouch(View v, MotionEvent event) {
float xPos = event.getX();
float yPos = event.getY();
ImageView iview = (ImageView)v;
Bitmap bitmap = ((BitmapDrawable)iview.getDrawable()).getBitmap();
int color = bitmap.getPixel(Math.round(xPos), Math.round(yPos));
myFrameLayout.setBackgroundColor(Integer.parseInt(Integer.toString(color), 16));
return true;
}