Would using a CursorAdapter tied to a database be a solution to this?
When the database changes, the cursor can auto-requery the database
(per the constructor's argument).
Will this prevent IlllegalStateExceptions?

On Oct 21, 9:34 pm, jsdf <[email protected]> wrote:
> pawpaw17,
> Any luck with this?
> Has anyone else come up with solutions for this?
> We are experiencing similar (sporadic) results.
>
> Thanks,jsdf
>
> On Oct 10, 11:22 pm, pawpaw17 <[email protected]> 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:
> > Thecontentof theadapterhaschangedbutListViewdidnotreceiveanotification. 
> > Make sure thecontentof youradapterisnotmodified from a background 
> > thread,butonly 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 arrayadapterknow things havechanged.
>
> > Does this exception always mean I'm doing something wrong with the
> > arrayadapterin 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 isnot
> > 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to