Adding touch event to a bitmap in android

1.2k views Asked by At

In my android app, there is a bitmap which moves around. This bitmap upon touch should change. How to add touch event to the bitmap. I have used touch event to surfaceview on which bitmap is drawn and then trying to calculate whether the bitmap is touched, but this is very tedious since there are 36 bitmaps.

1

There are 1 answers

0
tianwei On BEST ANSWER

As you are using SurfaceView,then the touch event is just about the point(x,y) that you touched on the whole surface.You need to calculate if this point is on one of your bitmap.

See this: Detect touch on bitmap