title: How to detect touch up after touch down
body: <p>I am trying to figure out how to detect when a finger is lifted from the screen. Essentialy I want my program to perform an action once a finger is down until that same finger is up what I have so far does not detect once the finger goes up:</p>
  
  <pre><code>for(int i = 0; i &lt; len; i++) {
      TouchEvent event = touchEvents.get(i);
      if(event.type == TouchEvent.TOUCH_DOWN) {
          while (event.type != TouchEvent.TOUCH_UP){
              if((event.y &gt; 160) &amp;&amp; ((world.batMan.getY() + world.batMan.getLength()) &lt; 319)) {
                  world.bat.moveSouth();
              }
              if((event.y &lt; 160) &amp;&amp; (world.batMan.getY() &gt; 0)) {
                  world.bat.moveNorth();
              }
              event = touchEvents.get(i);
          }
      }
  }
  </code></pre>
  
  <hr>
  
  <p>Solved it although I think I have now made it more complex than needed!</p>
  
  <p>for(int i = 0; i &lt; len; i++) {</p>
  
  <pre><code>        TouchEvent event = touchEvents.get(i);
  
  
  
          if (event.type == TouchEvent.TOUCH_UP)
          {
              System.out.println("WOOT");
              touchNorth = false;
              touchSouth = false;
          }
  
          else {
  
  
              if((event.y &gt; 160) &amp;&amp; ((world.bat.getY() + world.bat.getLength()) &lt; 319)
                      | (touchSouth == true))   {
                  touchSouth = true;
  
  
              }
  
              if((event.y &lt; 160) &amp;&amp; (world.bat.getY() &gt; 0) | (touchNorth == true)) {
                  touchNorth = true;
  
              }
  
          }
      }
  
  
      if((touchSouth == true) &amp;&amp; ((world.bat.getY() + world.bat.getLength()) &lt; 319))  {
          world.bat.moveSouth();
          touchSouth = true;
      }
  
      if(touchNorth == true &amp;&amp; (world.bat.getY() &gt; 0)) {
          world.bat.moveNorth();
          touchNorth = true;
  
      }
  </code></pre>