title: query regarding touch coordinates on an ImageView in Android
body: <p>I have an image in ImageView. I need to know the exact (x,y) coordinate of the image when I touch the image. I also want to draw a circle on the touch place. </p>
  
  <p>Given below, is the code I use. I have an ImageView and I attach a onTouchListener to it.</p>
  
  <p>The problem is this:</p>
  
  <ol>
  <li>I get weird (x,y) values </li>
  <li><p>new circles are only drawn 3 times. After that no new circles are drawn!</p>
  
  <pre><code>ImageView touch=(ImageView) findViewById(R.id.image);
  touch.setOnTouchListener(new View.OnTouchListener() {
      public boolean onTouch(View v, MotionEvent event) {
          if (event.getAction() == MotionEvent.ACTION_DOWN){
  
             //Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
             //Canvas can=new Canvas(bm);
             p.setColor(Color.RED);
             float fx=event.getX();
             float fy=event.getY();
             can.drawCircle(fx, fy, 20, p);                   
          }
          return true;
      }
  });
  </code></pre></li>
  </ol>