-1

I encountered a bug on ICS . Using a ListView and changing the adapter over time, I don't see any change to the content of the listView until I scroll down and then return to the top. I used these commands to notify the changes to the adapter :

adap.notifyDataSetChanged();
adap.notifyDataSetInvalidated();//added just to see if it solved... but it didn't resolve

In Gingerbread the code works perfectly.

Pshemo
  • 122,468
  • 25
  • 185
  • 269
Spotlight
  • 1,279
  • 1
  • 13
  • 28
  • are you calling `notifyDataSetChanged()` in your main thread i.e your UI thread? – Abhilasha Jul 20 '12 at 09:17
  • Also create a new adapter each time when you populate the `ListView` like `adapter = new ListViewCustomAdapter( SearchAssetActivity.this, itemList); lview3.setAdapter(adapter); adapter.notifyDataSetChanged();` – Abhilasha Jul 20 '12 at 09:19
  • Ok, re-create the ListView works... but why notifyDataSetChanged() doesn't work? PS: I call it in the UI thread – Spotlight Jul 20 '12 at 09:37

1 Answers1

0

Also create a new adapter each time when you populate the ListView like this:

adapter = new ListViewCustomAdapter(SearchAssetActivity.this, itemList);
lview3.setAdapter(adapter);
adapter.notifyDataSetChanged();

And as far as why notifyDataSetChanged() does not work.Please go through this. Even I faced similar issue.

notifyDataSetChanged example

Community
  • 1
  • 1
Abhilasha
  • 929
  • 1
  • 17
  • 37