Metric All post. I have a social media app project, and I want to detect and count the number of user who view the specific post/item in a recyclerView. Hope you have any idea about this. Thank you!
Asked
Active
Viewed 69 times
1 Answers
0
put count in your model class
int readCount
Like
class MyAdapterModelClass {
......
int readCount
......
void incrementReadCount(){
readCount++;
}
}
onBindViewHolder(position, holder){
items.get(position).incrementReadCount();
}

Muhammad Ahmed
- 1,038
- 1
- 7
- 7
-
this won't actually work correctly, because the recyclerview will bind a few items ahead of what is seen on the screen – a_local_nobody Feb 24 '21 at 07:16
-
you can use first and last visible item using layout manager https://stackoverflow.com/questions/24989218/get-visible-items-in-recyclerview Let me know if its works – Muhammad Ahmed Feb 24 '21 at 11:22
-
Thank you for your answers, I'll let you know once I try it. Thank you! – JonathanDevs Feb 24 '21 at 11:26