title: SurfaceView execute method while finger touches the screen
body: <p>This is most likely a trivial stuff but I can't find a solution for it.
  Things are simple, the user presses the screen and while he is holding the finger on the screen I want a piece of code to execute.</p>
  
  <p>Here is a code sample:</p>
  
  <pre><code>@Override
      public boolean onTouchEvent(MotionEvent event) {
          synchronized (getHolder()) {
              if (event.getAction() == MotionEvent.ACTION_DOWN) {
                          myobject.setX(myobject.getX() - 10);
              } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
  
              } else if (event.getAction() == MotionEvent.ACTION_UP) {
              }
              return true;
          }
      }
  </code></pre>
  
  <p>The effect of this code is that myobject.setX() only happens once, I want it to keep repeating while the user keeps the finger on the screen, so if it holds it for 3 seconds, myobject.setX() would decrease with -10 a few times.</p>