I am facing the issue that my adapter blinks when adapter.notifyDataSetChanged()
or adapter.notifyItemRangeChanged(0,recyclerView.getChildCount())
is called. I have tried so many solutions like setHasStableIds(true)
and overiding the getItemId()
to return id but it doesn't help me.
if (page == 1) {
homeAdapter = new HomeAdapter(getActivity(), homeBeanList, Home.
this, Home.
this, Home.
this, profile_pic, Home.
this, Home.
this, page);
loaderDiloag.dismissDiloag();
recyclerView.setAdapter(homeAdapter);
recyclerView.setNestedScrollingEnabled(false);
} else {
if (homeAdapter != null) {
try {
loaderDiloag.dismissDiloag();
recyclerView.setNestedScrollingEnabled(false);
homeAdapter.notifyItemRangeChanged(0, recyclerView.getChildCount());
} catch (Exception e) {
Log.e("error", e.toString() + "");
}
} else {
try {
homeAdapter = new HomeAdapter(getActivity(), homeBeanList, Home.
this, Home.
this, Home.
this, profile_pic, Home.
this, Home.
this, page);
loaderDiloag.dismissDiloag();
recyclerView.setAdapter(homeAdapter);
recyclerView.setNestedScrollingEnabled(false);
homeAdapter.notifyDataSetChanged();
} catch (Exception e) {
Log.e("error", e.toString() + "");
}
}