daimajia / AndroidSwipeLayout

The Most Powerful Swipe Layout!
MIT License
12.38k stars 2.67k forks source link

Do not treat position as fixed; only use immediately and call holder.getAdapterPosition() #404

Open SeLoRBIS opened 7 years ago

SeLoRBIS commented 7 years ago

A lint warning appear :

Do not treat position as fixed; only use immediately and call viewHolder.getAdapterPosition() to look it up later

The Docs of RecyclerView say :

Note that unlike ListView, RecyclerView will not call this method again if the position of the item changes in the data set unless the item itself is invalidated or the new position cannot be determined. For this reason, you should only use the position parameter while acquiring the related data item inside this method and should not keep a copy of it. If you need the position of an item later on (e.g. in a click listener), use getAdapterPosition() which will have the updated adapter position.

Will you update your library ? ex : public abstract void onBindViewHolder(VH viewHolder, final int position);

Thanks