I have some code that has got me very close to what Im trying to achieve. But there are a few issues. What I want to do is, when a Button is pressed and held, it will continuously call a method AdvanceLog(). The problem is, the ACTION_DOWN motion event does not continue to get called. What happens is, when you press and hold, the first motion is ACTION_DOWN and every motion thereafter while still holding down is ACTION_MOVE. This is causing some issues, as I am not REALLY looking for the move action, more so just the repetetive down action. Any suggestions?
advanceButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event)
{
int counter=0;
if(event.getAction()==MotionEvent.ACTION_DOWN || event.getAction()==MotionEvent.ACTION_MOVE)
{
fwdTouchCounter++;
AdvanceLog(true, true);
try
{
if(fwdTouchCounter>5)
Thread.sleep(30);
else
Thread.sleep(800);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
else if(event.getAction()==MotionEvent.ACTION_UP)
fwdTouchCounter=0;
return false;
}
});