at first i want to indruduce what i want to do:
I want to create a custom view element which i can handle input events from.
Custom view component should be a real custom figure i draw on myself, no image file.
Lets say e.g a snake.
How i tried to do this:
1.) View class ClickableShape
I created a class ClickableShape inheriting from View.
I overrided the method onDraw where i draw my "snake" figure.
2.) Input event handling
I also overrided the method onTouchEvent of ClickableShape.
But now all "klicks" on any place on canvas is recognised.
What i want to do is just capture the events on the figure itself. Lets say on the snakes body.
Is that possible with standard mechnism?
Maybe i have to get the click coordinates and the coordinates of the sanke body itself and check whether the click coordinates is inside?
If so, is there a known way to get the neccessary information? (Snake as coordinate list?)
Or am i totally on the wrong way? Maybe i took the wrong approach?