I am trying to update the data in 'onresume' when I come back to my main activity from different activities but its photo is not updating without scrolling the list.
they don't work;
detailRecyclerAdapter.notifyDataSetChanged();
detailRecyclerView.invalidate();
CodePudding user response:
You have to update the recycler view by passing updated data into the adapter by creating a setter method into the adapter.
fun setResultItem(arrResultItem: java.util.ArrayList<ResultsItem>) {
arrayList = ArrayList()
arrayList.addAll(arrResultItem)
notifyDataSetChanged()
}
Now, please update recycler view from activity by,
adapter.setResultItem(updatedList)