1

How do I pass the current position to my class that extends RecyclerView.ViewHolder? It needs it in order to create the view programmatically

Kaloyan Roussev
  • 14,515
  • 21
  • 98
  • 180

1 Answers1

5

RecyclerView holder already has getAdapterPosition() and getLayoutPosition() methods From the Docs:

final int   getAdapterPosition()
Returns the Adapter position of the item represented by this ViewHolder.

final int   getLayoutPosition()
Returns the position of the ViewHolder in terms of the latest layout pass.
JAAD
  • 12,349
  • 7
  • 36
  • 57