i have a bitmap inside a canvas.the class implements ontouchlistener.i need to hide the image while touch on the image.
class Panel extends View implements View.OnTouchListener {
Paint linepaint=new Paint();
public Panel(Context context) {
super(context);
}
@Override
public void onDraw(Canvas canvas) {
Bitmap imgtable = BitmapFactory.decodeResource(getResources(), R.drawable.table_01);
canvas.drawBitmap(imgtable, centrex, centrey, null);
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
return false;
}
}
Make on touch listener for the view where you draw the image. And there change the visibility of the view. Not in onDraw();
Edit:
If you set the
Bitmapimage for example on aImageView, thenonTouchListener()must be applied on the ImageView. Bitmap image is only a data that is supplied to the view(s).