For example, I move my finger down the screen and then back up. So, this should count as two drags, the last movement before I paused for a split second and after that when I moved back up. I basically count every time I make a new movement without lifting my finger off the screen. So, how do I get the last movement before I stop movement without lifting my finger?
I'm using motion event. Here is the code in action_move:
case MotionEvent.ACTION_MOVE:
posY = event.getY();
posX = event.getX();
diffPosY = posY - oldY;
diffPosX = posX - oldX;
if (checkMovement(posY, oldY)){
if (diffPosY > 0 || diffPosY < 0){
count +=1;
}
}
public boolean checkMovement(float posY, float oldY) {
int newY = Math.round(posY);
double distance = Math.abs(newY - oldY);
oldY = newY;
if (distance < 25)
return false;
return true;
}
Simple like this