#The Problem In the way of replacing ListViews with RecyclerView I hit this obstacle where there is no onItemClickListener in RecyclerView ??? And when googled, I found almost all the posts saying we have to implement this using the GestureDetector. And some of them had used interfaces which is what I too thought of using in the first place. But even they were so much confusing and complex to understand.
#Solution
- Interfaces (Donot worry if you never used one. But they are very simple concept) - CustomItemClickListener.java
- ViewHolder Adapter - ItemsListAdapter.java
- ViewHolder Item Class - ItemsListSingleItem.java
- The RecyclerView Itself - ItemsList (See Setting up the RecyclerView)
Consider for example you have a list of thumbnails and a title to be listed. I would do the following to keep stuff simple and working. :)
Checkout the sample project here
Hi @riyazMuhammad !
I am facing an issue and I thought that maybe you can help me. In my project each row has 1 ImageView and 2 TextView, when I press on a row it launches a ViewPager along with a few tabs. Now I also want to be able to click on the ImageView from each row, and to launch an activity displaying the image in full screen mode.
The problem is that when I press on the Image it starts the
ViewPager
activity, like theonClickListener
is not working at all, then I found out that if I press for a few second on that Image it will start the right activity displaying it in full screen mode. What am I doing wrong?Can you come up with a better example please?
Thank you!