Search code examples
androidandroid-recyclerviewgesturedetectorondoubleclick

How to detect double tap in RecyclerView item


I already have an OnClickListener when clicking on a RecyclerView item to open a new Activty. Now, I want to implement OnDoubleTap listener as well, but I'm not sure how.

Do I have to create a GestureDetector in the ViewHolder? On the other hand, isn't the RecyclerView gonna intercept the onTouch event because of the scroll?


Solution

  • Yes, best way to achieve this is by using GestureDetector. See sample code:

    https://developer.android.com/samples/BasicGestureDetect/src/com.example.android.basicgesturedetect/GestureListener.html