How to get item position after updating items
See original GitHub issueHello and thank you for your cool library ❤️ i have an implement of ViewBinder and in this binder i set position into models like this : `public class PositionViewBinder<M extends PositionViewBinder.PositionViewModel> extends ViewBinder<M> {
public PositionViewBinder(final int layoutID,
@NonNull final Class<M> type,
@NonNull final Binder<M> binder) {
super(layoutID, type, binder);
}
@Override
public void bindView(@NonNull final M model, @NonNull final ViewHolder viewHolder) {
super.bindView(model, viewHolder);
model.setPosition(viewHolder.getAdapterPosition());
}
public static class PositionViewModel implements ViewModel {
private int position;
public int getPosition() {
return this.position;
}
void setPosition(int position) {
this.position = position;
}
}
}`
but i need to update this position after another item removed because the position field hold old position how could i achieve this?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to update/refresh specific item in RecyclerView
You can use the notifyItemChanged(int position) method from the RecyclerView.Adapter class. From the documentation:.
Read more >Updating All Items Based on ItemCount & Position
If you have updated(add, remove or update) the items in the DataSource(`List` or ObservableCollection ), After that, you can use mAdapter.
Read more >Updating data in an Android RecyclerView - Suragch - Medium
Updating data in an Android RecyclerView · Overview · Insert single item · Insert multiple items · Remove single item · Remove multiple...
Read more >Difference between position getAdapterPosition(), and ...
Imagine that we have a RecyclerView that will display 10 items so it will create 10 items and call onBindView for those 10...
Read more >Recycleview scroll back to first item when calling recyclerView ...
My app needs to adjust an item's position right after the recycleview is made ... items view first, then it scrolls back to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

then you just should remove item from the list.
add special flag to your model, and update when it needs