title: Draw and remove a bitmap icon on canvas
body: <p>I am developing an app where the user can mark a damage icon on a car. The car here is basically an image and the damage icon is also an image. I am able to draw an image, where the user touches the car, using this code:</p>
  
  <pre><code>public class TestActivity extends Activity {
      private Button btn_save, btn_resume;
      private ImageView iv_canvas;
      private Bitmap baseBitmap;
      private Canvas canvas;
      private Paint paint;
      public Bitmap bt;
      public Bitmap ct;
      boolean ismove = false;
      private static final int SWIPE_MIN_DISTANCE = 50;
      int i = 0;
      private float x = 0;
  
      public HashMap&lt;String, String&gt; testholdmap = new HashMap&lt;String, String&gt;();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          // The initialization of a brush, brush width is 5, color is red
          paint = new Paint();
          paint.setStrokeWidth(5);
          paint.setColor(Color.RED);
  
          iv_canvas = (ImageView) findViewById(R.id.iv_canvas);
  
          iv_canvas.setOnTouchListener(touch);
  
          bt = BitmapFactory.decodeResource(getResources(),
                  R.drawable.damage_mark_r_ic);
      }
  
      private View.OnTouchListener touch = new OnTouchListener() {
          // Coordinate definition finger touch
          float startX;
          float startY;
  
          @Override
          public boolean onTouch(View v, MotionEvent event) {
              switch (event.getAction()) {
              // Press the user action
              case MotionEvent.ACTION_DOWN:
                  // The first drawing initializes the memory image, specify the
                  // background is white
                  if (baseBitmap == null) {
                      baseBitmap = BitmapFactory.decodeResource(getResources(),
                              R.drawable.b_ferrari_f152_000_0000).copy(
                              Bitmap.Config.ARGB_8888, true);
                      canvas = new Canvas(baseBitmap);
  
                  }
                  // Recording began to touch point coordinate
                  startX = event.getX();
                  startY = event.getY();
                  break;
              // The user's finger on the screen of mobile action
              case MotionEvent.ACTION_MOVE:
  
                  break;
              case MotionEvent.ACTION_UP:
  
                  float stopX = event.getX();
                  float stopY = event.getY();
                  if (startX == stopX) {
  
                      canvas.drawBitmap(bt, startX, startY, paint);
  
                      // The pictures to the ImageView
                      iv_canvas.setImageBitmap(baseBitmap);
                  } else if (startX - stopX &gt; 50 || stopX - startX &gt; 50) {
  
                      baseBitmap = null;
                  }
                  break;
              default:
                  break;
              }
              return true;
          }
      };
  
  }
  </code></pre>
  
  <p>My problem is figuring out how to remove this icon if it already drawn. I want it to function this way: I draw a damage icon on <code>x,y</code> position, and if the user clicks on <code>x,y</code> position again, then this damage icon will be removed.</p>
  
  <p>How can I achieve this?</p>