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

notifyDataSetChanged example

I'm trying to use in my Android Application the notifyDataSetChanged() method for an ArrayAdapter but it doesn't work for me. I found as answer here, that notifyDataSetChanged() should run in the main thread, but there was no example for…
Tima
  • 12,765
  • 23
  • 82
  • 125
150
votes
14 answers

notifyDataSetChange not working from custom adapter

When I repopulate my ListView, I call a specific method from my Adapter. Problem: When I call updateReceiptsList from my Adapter, the data is refreshed, but my ListView doesn't reflect the change. Question: Why doesn't my ListView show the new data…
Jasper
  • 2,389
  • 4
  • 25
  • 40
119
votes
11 answers

Android ListView not refreshing after notifyDataSetChanged

My ListFragment code public class ItemFragment extends ListFragment { private DatabaseHandler dbHelper; private static final String TITLE = "Items"; private static final String LOG_TAG = "debugger"; private ItemAdapter adapter; …
Coder
  • 3,090
  • 8
  • 49
  • 85
93
votes
8 answers

using notifyItemRemoved or notifyDataSetChanged with RecyclerView in Android

I am creating a list of cards to display using the RecyclerView, where each card has a button to remove that card from the list. When i use notifyItemRemoved() to remove the card in the RecyclerView, it removes the item and animates fine but the…
45
votes
6 answers

FragmentPagerAdapter notifyDataSetChanged not working

I got a FragmentPagerAdapter. It's getItem method can return a fragment according to data it has from the outside. After I update the data its suppose to display I call notifyDataSetChanged and yet nothing happened. I DID override the…
CodeMonkey
  • 11,196
  • 30
  • 112
  • 203
32
votes
8 answers

RecyclerView Adapter notifyDataSetChanged not working

I extended RecyclerView.Adapter And when I called: mRecyclerView.getAdapter().notifyDataSetChanged(); Nothing happened. The only way to refresh the view is to set again the adapter (see this…
David
  • 37,109
  • 32
  • 120
  • 141
28
votes
6 answers

Does notifydatasetchanged call onCreateViewHolder when using RecyclerView

I want to use a toggle to toggle between two different views but using the same RecyclerView. Basically, once you toggle, I want the RecyclerView adapter to recall onCreateViewHolder() but this time it will use a different layout item file. Does…
23
votes
3 answers

How to update some data in a Listview without using notifyDataSetChanged()?

I'm trying to create a ListView with a list of downloading tasks. The downloading tasks are managed in a Service (DownloadService). Everytime a chunk of data is received, the task sends the progress via a Broadcast, received by the Fragment…
jul
  • 36,404
  • 64
  • 191
  • 318
22
votes
2 answers

How to provide custom animation during sorting (notifyDataSetChanged) on RecyclerView

Currently, by using the default animator android.support.v7.widget.DefaultItemAnimator, here's the outcome I'm having during sorting DefaultItemAnimator animation video : https://youtu.be/EccI7RUcdbg public void sortAndNotifyDataSetChanged() { …
20
votes
4 answers

Are there any Observers written In RecyclerView.Adapter to know if dataset has been changed?

I have implemented my RecyclerView with it's Custom Adapter as follows Global Declarations as follows private LinearLayoutManager linearLayoutManager; private int pastVisibleItems, visibleItemCount, totalItemCount; private CustomRecyclerViewAdapter…
Nikhil
  • 3,711
  • 8
  • 32
  • 43
20
votes
10 answers

Why Glide blink the item ImageView when notifydatasetchanged

I am using Glide 3.7.0 with RecyclerView. The item view always blinks when refreshing (calling notifyDataSetChanged). Here is my code: Glide .with(context) .load(filepath) .diskCacheStrategy(DiskCacheStrategy.NONE) .skipMemoryCache(true) …
16
votes
3 answers

NotifyDataSetChanged- RecyclerView -Is it an asynchronous call?

I am trying to follow a set of statements after the execution of notifyDataSetChanged on a recyclerview. But when I am debugging my application, the debugger reaches the next few lines after my notifyDataSetChanged before going to the…
15
votes
10 answers

RecyclerView scrolls to top on notifyDataSetChanged in chat screen

I am trying to create messaging kind of screen using recyclerView which will start from bottom and will loadMore data when user reached top end of chat. But I am facing this weird issue. My recyclerView scrolls to top on calling…
15
votes
5 answers

Set notifyDataSetChanged() on Recyclerview adapter

I'm implementing an endless data loading for a RecyclerView. When software detects that last item is going to be shown, it downloads new items and call to the loadMoreData() function but new dataset is not showing. When I called…
14
votes
2 answers

How to dynamically add suggestions to autocompletetextview with preserving character status

Problem Description: I am facing some problem with AutoCompleteTextView where I have to show suggestions after each keypress. Thing is that, list of suggestion is dynamic like google's suggestion feature. It means the new suggestions should be added…
1
2 3
39 40