notifyDataSetChanged not working on RecyclerView
Try this method:
List<Business> mBusinesses2 = mBusinesses;
mBusinesses.clear();
mBusinesses.addAll(mBusinesses2);
//and do the notification
a little time consuming, but it should work.
In your parseResponse()
you are creating a new instance of the BusinessAdapter
class, but you aren't actually using it anywhere, so your RecyclerView
doesn't know the new instance exists.
You either need to:
- Call
recyclerView.setAdapter(mBusinessAdapter)
again to update the RecyclerView's adapter reference to point to your new one - Or just remove
mBusinessAdapter = new BusinessAdapter(mBusinesses);
to continue using the existing adapter. Since you haven't changed themBusinesses
reference, the adapter will still use that array list and should update correctly when you callnotifyDataSetChanged()
.