Suppose I have multiple drawings in my canvas, how can I add touch listener for each of the drawings seperately inside that canvas?
I will be having different drawings like star, circle, rectangle etc etc added dynamically how can I handle each of them ?
I couldn find ans in SO the very close question was this Set touch listeners on canvas drawings but it has no ans.
Help and suggestions will be appreciated. Thanks in advance :)
Actually you can't add any touch listener on the drawings of your canvas. You have to add the listener in your view then onTouchEvent you will get the x, y coordinates of user touch then have to calculate by your own if the touch location is any of your drawings .
For example