0

java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread.

Note : this question is already asked and i dint get a working answer

my list-view contains huge data`s

am calling the bellow code using handler when the data is changed in the list

 listviewAdapter.notifyDataSetChanged();

but i get the same error some times and not every time i load it thanks in advance

Sathyapradeep
  • 163
  • 1
  • 10
  • Are you updating your UI other than Main thread............ – nikki Apr 20 '12 at 12:13
  • possible duplicate of [list view java.lang.IllegalStateException even after calling notifyDataSetCanged();](http://stackoverflow.com/questions/10241765/list-view-java-lang-illegalstateexception-even-after-calling-notifydatasetcanged) Please don't ask the same question again. – user Apr 20 '12 at 12:16
  • @luksprong am asking the same question because i dint get a correct answer yet.. tr are no more visitors as there are 3 answers – Sathyapradeep Apr 20 '12 at 12:21
  • am not updateing my ui in the background thread – Sathyapradeep Apr 20 '12 at 12:22

2 Answers2

0

use below snippet where you want to update UI with in the thred

runOnUiThread(new Runnable() {
                        public void run() {

                            //update UI

                       }
                    });
  • if i change my code this way while loading my UI stucks for a while to load huge data`s... my datas my be 500+ listView items – Sathyapradeep Apr 20 '12 at 12:23
0

since there 2 threads (UI thread,handler Thread) this error is coming remove that Handler since its work in background .write the code in UI thread only(Its a main thread).

P Srinivas Goud
  • 886
  • 1
  • 12
  • 30