Reputation: 29
How do I set an onTouchListener for a Bitmap. e.g
pongball = BitmapFactory.decodeResource(getResources(), R.drawable.pongball);
Upvotes: 0
Views: 1447
Reputation: 16043
Wrap the bitmap object into a View, for example into an ImageView
:
imageView.setImageBitmap(pongball);
then set the touch listener to the ImageView:
imageView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
return false;
}
});
Upvotes: 3