How to update RecyclerView Adapter Data?

前端 未结 13 2328
误落风尘
误落风尘 2020-11-22 03:48

Trying to figure out what is the issue with updating RecyclerView\'s Adapter.

After I get a new List of products, I tried to:

  1. Update t

13条回答
  •  -上瘾入骨i
    2020-11-22 04:25

    If nothing mentioned in the above comments is working for you. It might mean the problem lies somewhere else.

    One place I found the solution was in the way I was setting the list to the adapter. In my activity the list was a instance variable and I was changing it directly when any data changed. Due to it being a reference variable there was something weird going on. So I changed the reference variable to a local one and used another variable to update data and then pass to addAll() function mentioned in above answers.

提交回复
热议问题