I am currently developing an Android application for my last project, which is to help autistic people indicate when something hurts and does this by touching a picture of the human body.
The problem I am facing is that I do not know how to identify the part of the image that they touch. An image is a bitmap that is stored in BitmapDrawable mode in ImageView. The first time it is touched, it is scaled using animation and setFilledAfter (true), and from there, when the area touches, the application should recognize the main body parts (for example, head, left hand ...).
The areas to be recognized are not square, so checking coordinates is not an option. I thought that each part would be recognized as a different view, drawn on top of the original picture, but I also open up other solutions.
To make things a little more interesting, the application should work on different devices and resolutions on both mobile phones and tablets.
Thank you in advance for your help. It is really necessary and appreciated.
EDIT
In the end, what I will try is the following. I will have two copies of the image, one for display and one for the inside, with the areas I want to recognize written in different colors. So the plan is to extrapolate the coordinates that I get from the Touch event, to find out which pixel it corresponds to in relation to the original, use Bitmap.getPixel () to determine the color of the waht, and then give the case statement returning A string of each piece.
I am coding this right now if someone is interested in leaving a message, and I will post how it works, and I ask it even with the appropriate code: D
Thanks to Shade for giving me several other options.
android view bitmap touch
Alex
source share