Clicking on a bitmap in Android Canvas?

If you bitmap is in a ImageView you should be able to handle the OnClickListener for the view to know when the bitmap was selected.

It's not in an imageview. It's drawn on a canvas. – JJG May 27 at 1:37.

While I enjoy doing this kind of maths, this time I would recommend going 'the easy way'. Set up a Rect/RectF with your image bounds and use rectF. Contains(float x, float y) or rect.

Contains(int x, int y) instead. That is, if onClick is not an option here, of course.

Another approach is to place the Bitmap in a Drawable and use it to test the bounds: public boolean onSingleTap(MotionEvent event) { int x = (int) event.getX(); int y = (int) event.getY(); if (drawable.getBounds(). Contains(x, y)) { // You’ve tapped the Bitmap... } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions