如何使用方法 NotifyItemInsert() 和 NotifyItemDataChanged() 在 RecyclerViewAdapter 上处理更新数组
how to do process update Array on RecyclerViewAdapter with methods NotifyItemInsert() and NotifyItemDataChanged()
I am use RecyclerView and obitan Adapter and while accept the new ListArray I do process update the Adapter to on view RecyclerView yet with methods notifyItemIndsert() or NotifyDataChanged():
two methods 'll be do yet view on RecyclerView
dsArrayList.addAll( arraylistadd);
// size() -1 be the lastIndext element count position
recyclerViewAdapter.notifyItemInsert(dsArrayList.size()-1);
dsArrayList.addAll( arraylistadd);
recyclerViewAdapter.notifyDataChanged()
我认为 notifyDataChanged 在您的情况下更有用,因为 notifyItemInsert 用于在某个位置插入的单个项目。
I am use RecyclerView and obitan Adapter and while accept the new ListArray I do process update the Adapter to on view RecyclerView yet with methods notifyItemIndsert() or NotifyDataChanged(): two methods 'll be do yet view on RecyclerView
dsArrayList.addAll( arraylistadd);
// size() -1 be the lastIndext element count position
recyclerViewAdapter.notifyItemInsert(dsArrayList.size()-1);
dsArrayList.addAll( arraylistadd);
recyclerViewAdapter.notifyDataChanged()
我认为 notifyDataChanged 在您的情况下更有用,因为 notifyItemInsert 用于在某个位置插入的单个项目。