Actually I wanna get singleTapConfirmed()
event inside onTouch method . As we all know we can use gestureDetector
class for that purpose but I wonder how to do that with onTouch
And I don't wanna call GestureDetector#onTouchEvent
I wanna detect that manually.
Below code is there for double tap from this answer but how to get singleTapConfirmed in this code
Code for DoubleTap:
imageView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
switch(event.getAction() & MotionEvent.ACTION_MASK)
{
case MotionEvent.ACTION_DOWN:
startTime = System.currentTimeMillis();
clickCount++;
break;
case MotionEvent.ACTION_UP:
long time = System.currentTimeMillis() - startTime;
duration= duration + time;
if(clickCount == 2)
{
if(duration<= MAX_DURATION)
{
Toast.makeText(imageView.getContext(), "double tap",Toast.LENGTH_LONG).show();
}
clickCount = 0;
duration = 0;
break;
}
}
return true;
}
});