You can do something like this:
public class MyImageView extends ImageView {
.
.
.
public boolean onTouchEvent(MotionEvent ev) {
BitmapDrawable bd = (BitmapDrawable)getDrawable();
Bitmap bitmap = bd.getBitmap();
int color = bitmap.getPixel((int)ev.getX(), (int)ev.getY());
// red --> Color.red(color)
// green --> Color.green(color)
// blue --> Color.blue(color)
return true;
}
}
--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together
The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.
On May 23, 7:37 am, guruk <[email protected]> wrote:
> Hi,
>
> i have a ImageView with a Picture in it.
> When I touch the Picture through the TouchScreen, how can i get the
> ColorCode (eg. 0xff0033933) from the x/y Coordinate I clicked?
>
> Something like: onTouch.GetColorCode (from the pixel bellow my
> finger)
>
> Any Idea?
>
> Thanks
> Yours Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---