Set notifyDataSetChanged() on Recyclerview adapter

前端 未结 5 991
说谎
说谎 2020-12-11 02:25

I\'m implementing an endless data loading for a RecyclerView. When software detects that last item is going to be shown, it downloads new items and call to the loadMor

5条回答
  •  既然无缘
    2020-12-11 02:30

    Issue is in these lines..

         adapter = new RVAdapter(RecyclerViewActivity.this, list);
            rv.setAdapter(adapter);
            adapter.notifyDataSetChanged();
    

    You are initialising your adapter every time. No need to reinitialize it. Just update your arraylist and invoking to adapter.notifyDataSetChanged(); will make it work.

提交回复
热议问题