title: Draw Circle onTouch on a Canvas Image Bitmap
body: <p>I am displaying an image using <code>Canvas</code> and <code>Bitmap</code>. Now I want to draw a Circle where I touch the <code>ImageView</code>. How can this be achieved?</p>
  
  <p>Instead of <code>tempCanvas.drawCircle(50,100, 60, myPaint);</code>,  I want something on the lines of 
  <code>tempCanvas.drawCircle(event.getX(),event.getY(), 60, myPaint);</code></p>
  
  <p>Here is my Code :</p>
  
  <pre><code>public class New extends Activity {
  
  public final int RESULT_LOAD_IMAGE = 1;
  public static int key = 0;
  
  ImageView imageView ;
  private Bitmap myBitmap;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
  
      imageView = (ImageView) findViewById(R.id.imgView);
      imageView.setAdjustViewBounds(true);
      Button buttonLoadImage = (Button) findViewById(R.id.buttonLoadPicture);
      buttonLoadImage.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
  
                              //Get Image from Gallery
              Intent i = new Intent(
                      Intent.ACTION_PICK,
                      android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
              Toast.makeText(getApplicationContext(), "Select Image to Load", Toast.LENGTH_SHORT).show();
              startActivityForResult(i, RESULT_LOAD_IMAGE);
          }
      });
  
  
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) {
          Uri selectedImage = data.getData();
          String[] filePathColumn = { MediaStore.Images.Media.DATA };
  
          Cursor cursor = getContentResolver().query(selectedImage,
                  filePathColumn, null, null, null);
          cursor.moveToFirst();
  
          int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
          String picturePath = cursor.getString(columnIndex);
          cursor.close();
  
          myBitmap = BitmapFactory.decodeFile(picturePath);
  
          Bitmap tempBitmap = Bitmap.createBitmap(myBitmap.getWidth(), myBitmap.getHeight(), Bitmap.Config.RGB_565);
          Canvas tempCanvas = new Canvas(tempBitmap);
          tempCanvas.drawBitmap(myBitmap, 0, 0, null);
  
          Paint myPaint = new Paint();
          myPaint.setColor(Color.WHITE);
          myPaint.setStyle(Paint.Style.STROKE);
          myPaint.setStrokeWidth(15);
          myPaint.setAlpha(60);
  
          imageView.setImageDrawable(new BitmapDrawable(getResources(), tempBitmap));
  
          tempCanvas.drawCircle(50,100, 60, myPaint);
      }
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  }
  </code></pre>