title: Android: executing the thread in a loop with onTouchListener()
body: <p>Hi in my app there are 8 buttons. Each button is configured onclickListener() when it is clicked the String is written ti the socket. Now i want that when i press and hold the button the String must be written in a loop. Here is what i am trying to do.</p>
  
  <pre><code>bLeft.setOnTouchListener(new View.OnTouchListener() {
  
          @Override
          public boolean onTouch(View arg0, MotionEvent event) {
              // TODO Auto-generated method stub
              MyThread start = new MyThread();
               boolean isReleased = event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL;
               boolean isPressed = event.getAction() == MotionEvent.ACTION_DOWN;
  
          while (isPressed) {
  
                  start.execute(ip, "left");
  
                  break;
          }
              return false;
          }
      });
  </code></pre>
  
  <p>Somehow i don't know why it is not working. start,execute(string, string) executes the thread in AsyncTask class to create a socket and output stream.</p>