Closed mrahimygk closed 6 years ago
adapterPosition
is what you're looking for. Do you use InfiniteScrollAdapter
?
Anyway, just put some effort and check how this was done in the sample app.
yes. with InfiniteScrollAdapter
, adaperPosition
is an integer much bigger than the actual length of my dataset array. Do I need to perform the modulo arithmetic? This gives me the wrong index:
adapterPosition % provinceAdapter!!.itemCount
Have you tried to read the docs or to look at the sample code?
Those are descriptive method names, Thanks to mention; so I know that what method I should be using. The problem is that sometimes cityInfiniteScrollAdapter!!.getRealPosition(adapterPosition)
gives me the wrong index. I think the method skips the last item in dataset.
I doubt it. The sample works fine and no one has ever reported this issue before.
I want to access the data model of the currently showing carousel item. I could not find this in the docs. tried to log the two arguments to see if they look like an index, but they are not indices.
Do I have to get the index by calling a method from the library? checking SO didn't lead to any usable solution. I think there is no way to access the currently showing item.