I have an image which implements both OnClickListener
and OnLongClickListener
. In the OnLongClickListener
at press down (ACTION_
Just use OnTouchListener and forget about OnLongClickListener. You can detect a long click by checking coordinates and pressed time, you have all that info in MotionEvent object passed by OnTouch().
1- To check coordinates, use getX() and getY() from MotionEvent and getDrawingRect() from your ImageView container.
2- To check for pressed time, use getEventTime(), storing first time in ACTION_DOWN and then compute by substracting with time in ACTION_UP event. You could assume like 800mS for a long click.