daimajia / daimajia/AndroidSwipeLayout

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

Open
#404 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.3k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.