title: Slow response onTouchEvent in Android View
body: <p>I created a View that listens for touch events and then draw a circle whenever you touched. Currently, it only tracks vertical position of the touch. </p>
  
  <p>There are the interesting code parts: </p>
  
  <p>onTouchEvent:</p>
  
  <pre><code>public boolean onTouchEvent(MotionEvent event) {
  
      int actionType = event.getAction();
      if (actionType == MotionEvent.ACTION_MOVE || actionType == MotionEvent.ACTION_DOWN ) {
  
          int px = getMeasuredWidth() / 2;
          int py = getMeasuredHeight() / 2;
  
          touchY = (event.getY() - py);
  
          if (touchY &lt; 25 &amp;&amp; touchY &gt; -25) {
              touchY = 0;
          }
          invalidate();
      }
      return true;
  }
  </code></pre>
  
  <p>Also, the onDraw:</p>
  
  <pre><code>@Override
  protected void onDraw(Canvas canvas) {
      int px = getMeasuredWidth() / 2;
      int py = getMeasuredHeight() / 2;
      int radius = px - innerPadding;
  
      canvas.drawCircle(px, touchY+py, radius - innerPadding, circlePaint);
      canvas.save();
  }
  </code></pre>
  
  <p>It works but I find that the circle following the finger is quite slow considering I have a Galaxy S3. It is smooth but it has a delay.</p>
  
  <p>Any advice of how to implement this better?</p>
  
  <p>Thank you. </p>