I have a onTouchlistener for a game that the object is to follow the dot around the screen with your finger for as long as you can. Therefore, if your finger goes out of bounds or if event.getAction() == MotionEvent.ACTION_UP, you lose. The problem is that MotionEvent.ACTION_UP is being fired 30 seconds after the MotionEvent.ACTION_DOWN starts the game, i disable the dot from moving and left it sitting in place and action_up still gets called exactly 30 seconds after the start, and roughly every 10-15 seconds after that.
However, when i disabled losing if action_up is called, and kept track of how many times it was called through log, i noticed that if i am not moving my finger calling action_move then action_up is never called. However, if i am moving my finger than action_up is called 30 seconds after i start, and 10-15 secs each time after that.
switch (event.getAction())
{
case MotionEvent.ACTION_DOWN:
if (checkForClickInDot(event.getX(), event.getY(), 1))
{
if (mState == STATE_NOT_STARTED)
setState(STATE_GAME_STARTED);
else if (mState == STATE_PAUSED)
setState(STATE_UNPAUSED);
}
break;
case MotionEvent.ACTION_UP:
if (mState == STATE_IN_PLAY)
setState(STATE_GAME_OVER);
break;
case MotionEvent.ACTION_MOVE:
if (!checkForClickInDot(event.getX(), event.getY(), 1))
{
if (mState == STATE_IN_PLAY)
setState(STATE_GAME_OVER);
}
break;
}