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
6
votes
0 answers

Why doesn't "notifyDatasetChanged()" notify all visible items?

Background Note: I've been using listViews for ages, so I'm very familiar with how to work with adapters, ViewHolders, etc... so this issue doesn't make sense for me. This time I got into a very weird behavior that for some reason occur only on 2…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
6
votes
2 answers

Replace List of ArrayAdapter

I have a custom ArrayAdapter that uses an ArrayList for my ListView. Inside this ListView I have an AutoCompleteTextView that also uses a custom ArrayAdapter with an ArrayList. On initialization this AutoCompleteTextView…
6
votes
2 answers

Keep focus on TextView after notifyDatasetChanged() was called on custom listview?

I have a listview adapter that when I modify my TextView, I call notifyDataSetChanged() on addTextChangeListener() method. But my TextView lose the focus. How I can keep the focus, overriding the notifyDataSetChanged()? I do that but didn't…
6
votes
2 answers

notifyDataSetChanged fails to update ListView

I have a DialogFragment which has a list view with CheckedTextView and a checkbox at the top to Check and uncheck all the items in the list view. I am trying to set the State of the CheckedTextView to Checked/Unchecked depending on the state of the…
5
votes
0 answers

about notifyItemInserted in RecyclerView

I find IllegalArgumentException: Called attach on a child which is not detached when use this mFeedAdapter.notifyItemInserted(0) to change data, to find this. But the solution is to change notifyItemInserted to notifyDataSetChanged. I don't want to…
5
votes
1 answer

How to keep focus on Edittext after notifyDataSetChanged?

Everytime I call notifyDataSetChanged in beforeTextChanged the focus of the edittext goes back to the first edittext inside the ListView. Did you encounter this kind of error? If yes, can you please give me some advice on how to deal with…
letsgotim
  • 99
  • 1
  • 9
5
votes
1 answer

notifyDataSetChanged() not refreshing expandable list view

I am using Expandable ListView and the data in it is populated through Sqlite database. I have given an option to delete a group from ExpandableListView and it actually deletes the respective row in the database. But the activity doesn't gets…
5
votes
2 answers

Android: ListFragment refresh using notifyDataSetChanged() with custom adapter does not work

I am using a ListFragment with a custom list adapter and I want to refresh the list with a click on a icon in the ActionBar. Unfortunately it does not work and I have no idea why. My ItemListFragment: @Override public void onCreate(Bundle…
5
votes
1 answer

notifyDataSetChanged() doesn't work with my adapter for gridview

I have a GridView and adapter for GridView (BasketAdapter extends BaseAdapter). I load data in GridView from sharedpref file. After I change data, I resave sharedpref file with data and call notifyDataSetChanged(). But notifyDataSetChanged()…
Denis
  • 341
  • 1
  • 5
  • 19
5
votes
2 answers

ExpandableListView getChildrenCount not called after data changed, leading to IndexOutOfBoundsException

In my Activity, I change the underlying data HashMap for my ExpandableListView, and then call ((BaseAdapter) myExpandableListView.getAdapter()).notifyDataSetChanged(); However, the app crashes after calling this, raising an…
4
votes
2 answers

RecyclerView duplicating items after deletion from contextual action mode

In this part of my app, I am trying to implement deleting of selected favorite items via contextual action mode/bar, the problem is when I select an item then delete, it's deleted from the database and selected list but it is still available in…
4
votes
8 answers

recyclerview notifyDataSetChanged() is not working

I am trying to update myadapter using notifyDataSetchanged() in updateList().But not working for recyclerview. I can able to see list size in updateList() and its displaying actual result but only reclerview is not updating.This class was designed…
malli
  • 642
  • 2
  • 12
  • 30
4
votes
2 answers

Why Fragment onResume() not udating RecyclerView Correctly?

in my app i schedule downloading task using AlarmManager when Download time arrives from Alarm Receiver Service i Download File and Delete from ArrayList of Custom Object and then save it using sharedpref and after this starting Activity if it is…
4
votes
1 answer

RecyclerViewAdapter.notifyDataSetChanged() on a null object reference

I got an error with notifyDataSetChanged() on RecyclerView when I press back button. This is the code: MainActivity.java class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public…
4
votes
1 answer

ArrayAdapter notifyDataSetChanged from AlertDialog doesn't work

I show items from my SQLite database in a Listview. For adding Items I use a AlertDialog. In the ALertDialog I save the item in my database and refresh the List (userLists) with the data from the database. Then I use notifyDataSetChanged but the…
Laire
  • 1,290
  • 6
  • 22
  • 49
1 2
3
39 40