title: ImageView click best practice
body: <p>I am a newbie in Andoird.</p>
  
  <p>In my case, I have a scenario that when click certain part of an image it will trigger onclick events. I tried to detecte the position when the onTouch is fired, it works, but I think it's not a standard implementation, so what is the best practice for such case?</p>
  
  <p>thanks.</p>
  
  <p>here is codes like:</p>
  
  <p>imgView.setOnTouchListener((OnTouchListener) new OnTouchListener(){ </p>
  
  <pre><code>public boolean onTouch(View v, MotionEvent event) { 
      if(isIn(event.getX(), event.getY(), 124,3,221,36)){ 
          ShowMemberInfo(R.string.app_m01); 
      } else if(isIn(event.getX(), event.getY(), 8,155,72,181)){
           .. 
      } 
      return true; 
  } 
  private boolean isIn(float x, float y, int fx, int fy, int tx, int ty) { 
      return x&lt;tx &amp;&amp; x &gt; fx &amp;&amp; y&lt;ty &amp;&amp; y&gt;fy; 
  }
  </code></pre>