title: How continue updating screen without flooding onTouchEvent ? (android SurfaceView)
body: <p>When you have a surfaceView class, used for animation/game/... you have the onTouchEvent() method and the drawing/screen-refreshing method in that same class. Now I want to just sleep the onTouchEvent method, so it doesn't get called +-80 times a second and flooding the cpu (and therefor causing lag). The problem is that if I sleep this class, it also stops drawing/updating/refreshing. What could be a good solution for this?</p>
  
  <p><strong>Edit</strong><br>
  @tanner, that's indeed what i'm trying, to stop onTouchEvent() to be called too frequently. my attempt: </p>
  
  <pre><code>@Override
  public boolean onTouchEvent(MotionEvent event) {
      Log.d("firstTest",Integer.toString(event.getAction()));   //shows up
      if (!sleeper.CurrentlySleeping) {
          Log.d("2ndTest",Integer.toString(event.getAction())); //not showing up
          ~~  some calculations and stuff  ~~
  </code></pre>
  
  <p>.   </p>
  
  <pre><code>public class TouchSleeper extends Thread {
  // If Thread is sleeping or not.
  public static Boolean CurrentlySleeping;
  public TouchSleeper() {
      CurrentlySleeping = false;
      this.setPriority(MIN_PRIORITY);
      }
  
  @Override
  public void run() {
      try {
          while (true) {
              CurrentlySleeping = true;
              TouchSleeper.sleep(50);
              CurrentlySleeping = false; }
          ~end~
  </code></pre>
  
  <p>First a piece of code from my SurfaceView class. Second piece of a class/thread, wich keeps changing a boolean value. Note how my first Log.d does return something, and the second one doesn't. This tells me that CurrentlySleeping is never false ? I still have not figured things out... ?</p>