How can I add touch capabilities to a simple bitmap?
I’ve tried to create a wrapper class for a bitmap,
which implemented OnGestureListener,
but it didn’t work.
I want to avoid extending View class to achieve this.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A
Bitmapper se is just a representation of an image… thus, in order to show it you will have to draw it somewhere (aView, in fact you always draw it on aView). Then, there’s no way to avoid using theViewclass since all user interface widgets extend it.In conclusion, if you want to simply set touch listeners to a single
Bitmapyou can, for instance, draw it on aImageViewand set the appropriate listeners. On the other hand, if you have a set of bitmaps drawn somewhere (for instance, on aSurfaceView), you should locate the bitmap by its coordinates (in that case, theViewwhich would receive the events will be theSurfaceView).