currently i am looking for ideas how to implement a dwelling time to the onTouch function. Normally the onTouch event does only process the events Up, Down, and Motion.
I want the user to be able to touch down anywhere, after that he can swipe to an object on the screen and if he stays still (=little to no movements) for a certain time an action is fired.
Is there a ways to get events for not moving while touching or any other type of event i can use for this behaviour? My current solution is rather... ugly
touch = new Vector2D(event.getX(),event.getY());
//if (not moving && touching && (System.nanoTime-currentNanoSeconds) > Value)
if(event.getAction()==MotionEvent.ACTION_MOVE){
currentNanoSeconds=System.nanoTime();
System.out.println(currentNanoSeconds);
}
if(event.getAction()== MotionEvent.ACTION_UP){
currentAngle=(float) angleBetween2Lines(midPoint, lineEnd, touch);
System.out.println((System.nanoTime()-currentNanoSeconds)/1000000);
touching=false;
checkTargets();
//forces redraw!
invalidate();
}
if(event.getAction()==MotionEvent.ACTION_DOWN)
touching=true;
return true;
thanks in advance.