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.
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;
}
});
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.