title: How the onTap works in android mapview
body: <p>How the onTap listener works in android map view even if the map view is moved.
  actually i am rotating map view based on user direction.</p>
  
  <p>i am getting bearing angle from sesor manager.</p>
  
  <p>if angle is 0 the onTap works correctly on Pin.If the angle is changed say 20 onTap not working exactly on pin it works beside the pin after some space .</p>
  
  <p>I taken on Rotate View inside that i taken mapview .Now i rotation rotateview after bearing changes. </p>
  
  <p>RotateView setting bearing code</p>
  
  <pre><code> @Override
      protected void dispatchDraw(Canvas canvas) {
  
          canvas.save(Canvas.MATRIX_SAVE_FLAG);
  
      //if mHeading is zero its work otherwise onTap position is changing 
          canvas.rotate(mHeading, getWidth()/2, getHeight());
  
          mCanvas.delegate = canvas;
          super.dispatchDraw(mCanvas);
          canvas.restore();
      }
  </code></pre>
  
  <p>Overlay class</p>
  
  <pre><code>public class SonarOverlay1 extends ItemizedOverlay&lt;OverlayItem&gt;
  {
      private ArrayList&lt;OverlayItem&gt; mOverlays = new ArrayList&lt;OverlayItem&gt;();
      private Context mContext;
  public SonarOverlay1(Drawable defaultMarker,Context context) {
      super(boundCenter(defaultMarker));
      this.mContext=context;
  
      populate();
  }
  
  @Override
  protected OverlayItem createItem(int arg0) {
  
      return  mOverlays.get(arg0);
  }
  public void addOverlay(OverlayItem item) {
      mOverlays.add(item);
      populate();
  
  }
  
  @Override
  public int size() {
  //Log.e("overlay size..",""+mOverlays.size());
      return mOverlays.size();
  }
  
  
  @Override
  protected boolean onTap(int index) {
      // TODO Auto-generated method stub
  
        OverlayItem item = mOverlays.get(index);
        AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
        dialog.setTitle(item.getTitle());
        dialog.setMessage(item.getSnippet());
        dialog.show();
        return true;
  }
  }
  </code></pre>