Questions tagged [notifydatasetchanged]

Android Adapter notifyDataSetChanged() method notifies observers that the underlying data has changed

Android Adapter notifyDataSetChanged() method notifies observers attached to the adapter that the underlying data has changed and any Views reflecting the data should be refreshed.

Use this tag for example with questions related to problems refreshing AdapterViews such as ListView. Include also the main subject tag .

595 questions
13
votes
10 answers

RecyclerView is duplicating items

My recyclerview is duplicating items when I roll it and I'm already calling adapter.notifyDataSetChanged(). So, probably I'm calling data set update at wrong place, but I can't find how it works. Here is some code: RecyclerView…
Alan Godoi
  • 657
  • 1
  • 12
  • 39
9
votes
3 answers

How to recycleview adapter under another recycleview adapter?

I have a RecyclerView. It has a custom layout and inside the custom layout is another RecyclerView. When I notify the recycler view that an item has been deleted, my main recycler view is updated but my custom view recycle view is not getting…
9
votes
3 answers

Why do I not need to use Adapter.notifyDataSetChanged()?

the contactsList is empty until the readContacts()method was executed, in other words, when contactsView.setAdapter(adapter) was executed, the contactsList is empty, so why this code still can show contacts' info correctly? public class MainActivity…
9
votes
1 answer

android getChildView is not being called after notifyDataSetChanged

I have a expandableListView and tried to change its childs like that: ((SubItem) adapter.getChild(i+1, 5)).setCount(unreadBox); adapter.notifyDataSetChanged(); Here is my adapter class: public class DrawerAdapter extends BaseExpandableListAdapter…
nAkhmedov
  • 3,522
  • 4
  • 37
  • 72
7
votes
2 answers

How to avoid notifyDataSetChanged on a Filterable Adapter?

I am in the process of improving my app stability and performance, but right now I am stuck at a warning from Android Studio. Please consider the following Adapter class: private class CoinsAdapter(private val fragment: CoinFragment, private val…
Ravers
  • 988
  • 2
  • 14
  • 45
7
votes
3 answers

Issue refreshing a view of a row in recyclerview

I want to update a view of the recyclerview when a notifyItemChanged has been called. The thing is that I don't want to refresh the entire row but only the view of the row. (to avoid the blinking effect of the row) There is a method called…
chathura
  • 3,362
  • 6
  • 41
  • 68
7
votes
4 answers

Android Adapter "java.lang.IndexOutOfBoundsException: Invalid index 4, size is 4"

I have problem with deleting item's from ArrayList and synchronising Adapter. I have my RecyclerView adapter with some ArrayList inside it called items. I download some list from the server and dispaly inside it. Whenever I click on some of list…
7
votes
4 answers

How to avoid refreshing of cells on when calling notifyDataSetChanged() for PinterestLikeAdapterView?

Background I'm using the PinterestLikeAdapterView library to show some images from the internet, which is like a gridView but with different height for each cell. The problem Since I use this library to show images from the internet, it's crucial…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
7
votes
7 answers

Android ListView refresh

I have a Listview which pulls and displays data from a sqlite DB. Data in the first column of the DB is displayed in the ListView and when clicked, an Activity starts showing the rest of the column associated with the first column. When the data is…
6
votes
2 answers

Fragment does not respond to UI updates and eventbus events after resume

I have a SearchFragment class which extends a class called BaseFragment in which onResume and onStop are overridden as below: @Override public void onResume() { checkEventBusRegistration(); super.onResume(); } @Override public void onStop() { …
6
votes
7 answers

notifyDataSetChanged() not refreshing adapter

My adapter list is refreshing on broadcast receiver . Everything is working fine if adapter list size is greater than 1 , means if my recyclerview has already one row shwoing then list refreshing just fine . But if list size goes from 0 to 1…
young_08
  • 1,196
  • 2
  • 13
  • 35
6
votes
3 answers

How to swap item from one section to another section and vice versa in Recycler view?

I have a RecyclerView and I want to show that RecyclerView with two sections. First time section one will be empty and I want to drag item from section two to section one. When item is added to section one and it should be deleted from section two…
Vishal
  • 108
  • 1
  • 9
6
votes
1 answer

RecyclerView not refreshing after rotating the device with an open DialogFragment

I have a RecyclerView inside a AppCompatActivity. Item insertions and changes are shown and animated correctly after rotating the device. The problem happens when you: Tap on an item in the RecyclerView. A DialogFragment opens prompting if you want…
6
votes
3 answers

What is notifyItemRangeChanged(0, this.data.size()); in this example and how does it work?

I understand how a ViewHolder's onBindViewHolder works, however I'm unclear about how notifyItemRangeChanged(0, this.data.size()); works in this example and what it does exactly. The data that is supplied to this adapter is in Json format. The…
eli
  • 335
  • 1
  • 3
  • 18
6
votes
1 answer

Error: Cannot Resolve notifyDataSetChanged(); Android

I'm having some trouble with updating my ListView. So I used notifyDataSetChanged(); but it says that it can't be resolved. Heres the part of the code that is not working: public void onCreate(Bundle savedInstanceState) { …
epiclapser
  • 271
  • 4
  • 12
1
2
3
39 40