Top card doesn't change on NotifyDataSetChanges
See original GitHub issueI am using an arraylist in my adapter as the data source for the cards. On a button toggle, I have to change the cards displayed. Hence I call the clear()
function of my array and then do an addAll()
with the required data. Followed by a call to the adapters notifyDataSetChanged()
The data does change but the first card is the same as what i saw before the button toggle. on swiping away this card I see that the next card is the second card of my second list(and same for the 3rd,4th etc hence I conclude the data has changed). But why didn’t the first card refresh to show the new list?
Issue Analytics
- State:
- Created 9 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
RecyclerView scrolls to top on notifyDataSetChanged in chat ...
This is my way to avoid scrollview move to top Instead of using notifyDataSetChanged() , I use notifyItemRangeChanged();
Read more >Updating data in an Android RecyclerView - Suragch - Medium
Replace old list with new list ... Clear the old list then add a new one. ... adapter.notifyDataSetChanged();. The adapter has a reference...
Read more >RecyclerView notifyItemChanged Prevent Scroll [37087322]
Hi! Have a trouble with RecyclerView after support library 23.2.1 release. This method below is inside my custom RecyclerView.Adapter.
Read more >NotifyDataSetChanged: Invalidating All RecyclerView Data
The RecyclerView adapter's onNotifyDataSetChanged method does not specify what about the data set has changed, forcing any observers to assume that all ...
Read more >Calling NotifyAll to Update RecyclerView from External Method
You can add a function in the Adapter of your RecyclerView (e.g. UpDateData ) and call NotifyDataSetChanged in your Adapter . public void ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I solved this by using flingContainer.removeAllViewsInLayout();
+1 for
flingContainer.removeAllViewsInLayout();