I have onLongPress and onDoubleTap actions placed on the button according to this code:
...
GestureDetector detector = new GestureDetector(this, new TapDetec
Technically this shouldn't happen
case MotionEvent.ACTION_DOWN:
mLastMotionX = x;
mLastMotionY = y;
mCurrentDownEvent = MotionEvent.obtain(ev);
mAlwaysInTapRegion = true;
mInLongPress = false;
if (mIsLongpressEnabled) {
mHandler.removeMessages(LONG_PRESS);
mHandler.sendEmptyMessageAtTime(LONG_PRESS, mCurrentDownEvent.getDownTime()
+ tapTime + longpressTime);
}
mHandler.sendEmptyMessageAtTime(SHOW_PRESS, mCurrentDownEvent.getDownTime() + tapTime);
because on the ACTION_DOWN or ACTION_UP event, all of the LONG_PRESS messages events are removed from the queue. So on the second tap the following code will remove the long press events.
mHandler.removeMessages(LONG_PRESS);
Ninja edit : hacky workaround for your problem
@Override
public void onLongPress(MotionEvent e) {
if(MainActivity.this.hasWindowFocus())
{
Log.d("Touchy", "Long tap");
}
}