How can I recognise which area of an image (not just coordinates) has been touched in Android?

Without having thought too much about this, it seems that your idea - to detect touches with overlay Views - seems to be good Apart from that, coordinates are also a good idea - you just have to define named areas of the image and check if the point of touch is within a certain area. Could be a bit more tedious, but may be better in terms of complexity when compared to having 20 views. It will also definitely be faster than adding 20 extra views in your application But above all, I think that you should experiment and see what is suitable to your concrete situation, because all else is guesswork EDIT: If you do choose to use the polygon method, then you will have to deal with the problem of determining whether a point is inside of a polygon ( see here for a short explanation) Also, regarding Views, a View in Android is defined as a "rectangular area that occupies space on the screen".

So that eliminates the possibility of non-rectangular Views. Perhaps there is the possibility of you defining a non-rectangular clickable area inside of a View, but I don't know if that is at all possible.

Without having thought too much about this, it seems that your idea - to detect touches with overlay Views - seems to be good. Apart from that, coordinates are also a good idea - you just have to define named areas of the image and check if the point of touch is within a certain area. Could be a bit more tedious, but may be better in terms of complexity when compared to having 20 views.It will also definitely be faster than adding 20 extra views in your application.

But above all, I think that you should experiment and see what is suitable to your concrete situation, because all else is guesswork. EDIT: If you do choose to use the polygon method, then you will have to deal with the problem of determining whether a point is inside of a polygon (see here for a short explanation). Also, regarding Views, a View in Android is defined as a "rectangular area that occupies space on the screen".

So that eliminates the possibility of non-rectangular Views. Perhaps there is the possibility of you defining a non-rectangular clickable area inside of a View, but I don't know if that is at all possible.

Thanks for the quick reply. My problem with both solutions is that the areas aren't square (nor rectangular), so coordinates would be really problematic (try to define a hand as sets of coordinates...). Similarly I don't know how to define Views in android which are not rectangular, and even if there's a way, how would I go about to display them?

I mean, how can I position each of this views correctly on top of the zoomed in View? Thanks again. – Alex Mar 7 at 11:28 @user647899, see my edit.

I think that this problem should be dealt with in another question here, depending on which approach you choose to use. There have already been questions on SO about the PIP problem, so you can just search. – Shade Mar 7 at 11:59 @user647899, if my answer was helpful, please consider marking it as the selected answer for the question.Thanks.

– Shade Mar 7 at 20:01 Your help is much appreciated, though I don't think I will be going down the PIP route, basically because the images I am working with are bitmaps and I'd have to redraw them as polygons. It did make for a very interesting read though. I think I have figured a way to make work without too much hassle.

Look at my edit to see what I am trying. – Alex Mar 7 at 8:11.

This is how you implement a touch listener in Android. 2) Create an instance of your gesture detector. I'm making a member variable and instantiating in onCreate.

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