I\'m trying to figure out the best way to get the pixel color value at a given point on a View. There are three ways that I write to the View:
I set a back
How about load the view to a bitmap (at some point after all your drawing/sprites etc is done), then get the pixel color from the bitmap?
public static Bitmap loadBitmapFromView(View v) {
Bitmap b = Bitmap.createBitmap( v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height);
v.draw(c);
return b;
}
then use getPixel(x,y) on the result?
http://developer.android.com/reference/android/graphics/Bitmap.html#getPixel%28int,%20int%29