Vij
Vij

Reputation: 445

Unable to get RecyclerView ItemView position when scroll?

I am using Chat RecyclerView in my chat app in which I have text, image and video 3 type ItemView. I update specific item using :

Recylerview.findViewHolderForAdapterPosition(int pos) 

successfully, but when I scroll RecyclerView, change position of item view. So what solution for that? Please any help would be appreciated.

Upvotes: 0

Views: 116

Answers (1)

Tavinder Singh
Tavinder Singh

Reputation: 420

In onBindViewHolder() function of your adapter you can use the below code to get the position

@Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
    Log.d("position", holder.getAdapterPosition());
}

Upvotes: 1

Related Questions