Best way to update data with a RecyclerView adapter [duplicate]
RecyclerView’s Adapter doesn’t come with many methods otherwise available in ListView’s adapter. But your swap can be implemented quite simply as: class MyRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { List<Data> data; … public void swap(ArrayList<Data> datas) { data.clear(); data.addAll(datas); notifyDataSetChanged(); } } Also there is a difference between list.clear(); list.add(data); and list = newList; The first is reusing … Read more