I have read many posts about implementing an OnItemClickListener
in the RecyclerView
, but the more I read, the more I get confused. It seems that we have two ways to implement the OnItemClickListener
:
- Adding
setOnClickListener
inside the adapter as shown here - Implementing
RecyclerView.OnItemTouchListener
as shown here
As I read the posts I figure out that the first method is better and has more features than the second method. For example, there's item click support. What is the benefit of the second method? Why and whe should I use it? Any suggestions?