0

Is it possible to detect Recyclerview scrolling inside:

override fun onBindViewHolder(holder: ViewHolder, position: Int) {

}

?

Maybe with a workaround? But without using notifyItemChanged(pos) and notifyDataSetChanged()

I need it to be able to detect when a video is fully visible and then start it if it is and stop when it's not fully visible any more

a_local_nobody
  • 7,947
  • 5
  • 29
  • 51
  • See this answer https://stackoverflow.com/a/33455266/14884388. If its not what you are looking for we can further work around. – Hascher Mar 06 '21 at 20:46
  • This is how you set scroll listener in activity/fragement where you initialize RecycleView but I need to detect scroll from within item –  Mar 06 '21 at 21:10
  • May I ask why you can't use the notify methods? – Henry Twist Mar 06 '21 at 22:53
  • Because it reloads the whole item and the video would start from beginning again, besides it's just overkill in general –  Mar 06 '21 at 22:59
  • `onBindViewHolder` can get call multiple times . The solution to your problem is to put a scrolllistener on the `RecyclerView` and check for visible item and then provide callback to adapter . – ADM Mar 07 '21 at 05:31
  • I don't understand it, can you show example for "onBindViewHolder can get call multiple times"? Or the whole process? –  Mar 07 '21 at 09:37

0 Answers0