>I don't seem to be manipulating it at all in the background > thread; only the array list it is > connected to.
That's your problem right here. You cannot change the adapter's data from outside the UI thread. On Tue, Nov 17, 2009 at 7:38 PM, WoodManEXP <woodman...@gmail.com> wrote: > I have run into this, pretty much exactly as you describe it, starting > with Android 1.6, but not before. Get any ideas about what's going on? > > On Oct 10, 11:22 pm, pawpaw17 <georgefraz...@yahoo.com> wrote: >> I'm getting an unhandled exception in my class that fills an >> arrayadapter from items in a database: >> >> 10-11 04:05:26.883: ERROR/AndroidRuntime(886): >> 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. >> >> At the end of my OnCreate method I fire off a background thread: >> >> Thread thread = new Thread(null, doSearchDatabase, >> "Background"); >> thread.start(); >> >> I fill the array list in the run method of the thread, and use a >> handler to post a message >> at the end of the processing: >> >> hh.post(postdoSearchDatabase); >> >> In the run method of the handler, which I presume is a UIThread, I do: >> >> Collections.sort(myArrayList); >> aa.notifyDataSetChanged(); >> >> Here I do let the array adapter know things have changed. >> >> Does this exception always mean I'm doing something wrong with the >> array adapter in a background >> thread? I don't seem to be manipulating it at all in the background >> thread; only the array list it is >> connected to. >> >> Any ideas? the exception isn't thrown every time, and if I step slowly >> through in the debugger it is not >> thrown. Seems FAR worse running in Android 1.6. >> >> thanks, >> >> pawpaw17 > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en