Yeah, it's the main thread of my app, here's the stack:

myApp [Android Application]
myApp [Android Application]
        DalvikVM[localhost:8613]
                Thread [<3> main] (Suspended (exception IllegalStateException))
                Thread [<15> Binder Thread #3] (Running)
                Thread [<13> Binder Thread #2] (Running)
                Thread [<11> Binder Thread #1] (Running)


Thread [<3> main] (Suspended (exception IllegalStateException))
        ListView.layoutChildren() line: 1596
        ListView(AbsListView).onLayout(boolean, int, int, int, int) line:
1112
        ListView(View).layout(int, int, int, int) line: 6569
        LinearLayout.setChildFrame(View, int, int, int, int) line: 1119
        LinearLayout.layoutVertical() line: 998
        LinearLayout.onLayout(boolean, int, int, int, int) line: 918
        LinearLayout(View).layout(int, int, int, int) line: 6569
        FrameLayout.onLayout(boolean, int, int, int, int) line: 333
        FrameLayout(View).layout(int, int, int, int) line: 6569
        LinearLayout.setChildFrame(View, int, int, int, int) line: 1119
        LinearLayout.layoutVertical() line: 998
        LinearLayout.onLayout(boolean, int, int, int, int) line: 918
        LinearLayout(View).layout(int, int, int, int) line: 6569
        PhoneWindow$DecorView(FrameLayout).onLayout(boolean, int, int, int,
int) line: 333
        PhoneWindow$DecorView(View).layout(int, int, int, int) line: 6569
        ViewRoot.performTraversals() line: 979
        ViewRoot.handleMessage(Message) line: 1613
        ViewRoot(Handler).dispatchMessage(Message) line: 99
        Looper.loop() line: 123
        ActivityThread.main(String[]) line: 4203
        Method.invokeNative(Object, Object[], Class, Class[], Class, int,
boolean) line: not available [native method]
        Method.invoke(Object, Object...) line: 521
        ZygoteInit$MethodAndArgsCaller.run() line: 791
        ZygoteInit.main(String[]) line: 549
        NativeStart.main(String[]) line: not available [native method]

None of my code in this stack.

Any thoughts on how to track this down? I'm sure I'm doing something
wrong - but it was never a problem
as far as I knew running with 1.5.

I spawn a thread at the end of "OnCreate" in my Activity that reads
values from a database and populates
the listView. The database reading is done in the worker thread, and I
sort the list and tell the arrayadapter
to notify tht the list has changed in a routine that gets called from
my handler, ie I post at the end of the run
method of the worker thread so I can notify the array adapter from the
UI thread.

        private void fillList(){
                Collections.sort(myArrayList);
                                // aa is an arrayAdapter
                aa.notifyDataSetChanged();
                }

Thanks for any thoughts you guys have on this.

Very best,

pawpaw17

On Oct 11, 10:20 am, RichardC <richard.crit...@googlemail.com> wrote:
> When you get the error, can you see from the traceback which thread
> you are in?
>
> --
> RichardC
>
> On Oct 11, 4:06 pm, ccfrazier2 <georgefraz...@yahoo.com> wrote:
>
>
>
> > Romain,
>
> > thanks for confirming that this message is new in 1.6.
>
> > Actually, I mean to write "I'm sure my adapter mods are IN the UI
> > thread, not the background thread". Anything else that can cause this?
>
> > If I step through the code in the debugger I don't get the exception,
> > but I I run without stepping I do. Also, when I run the phone on
> > the app, I can get it to "work" 3 or 4 times, and then eventually I'll
> > get the force close.
>
> > Can anything else cause this?
>
> > Here's my code in the background thread:
>
> >         public void run(){
> >                 int i = 0;
> >                 lsDb.openDataBase();
> >                 rescursor = lsDb.Search();
> >                 if (rescursor.getCount() > 0){
> >                     id_index = rescursor.getColumnIndex("_id");
> >                     name_index = rescursor.getColumnIndex("Name");
> >                     calories_index = rescursor.getColumnIndex("Calories");
> >                     extra_index = rescursor.getColumnIndex("sodium");
> >                 }
> >                 if (rescursor.moveToFirst()){
> >                         do {
> >                                 int id = rescursor.getInt(id_index);
> >                                 String name = 
> > rescursor.getString(name_index);
> >                                 int calories = 
> > rescursor.getInt(calories_index);
> >                                 double extra= 
> > rescursor.getDouble(extra_index);
> >                                                                 // add
> > to array list
> >                                 myArrayList.add(i, new CalStats(name, 
> > extra, calories));
> >                                 i++;
> >                                 }
> >                         while (rescursor.moveToNext());
> >                 }
> >                 rescursor.close();
> >                 lsDb.close();
> >                 hh.post(postdoSearchDatabase);
> >         }
>
> > The "post" at the end is to a handler. I **do** modify the adapter in
> > the run method there.
>
> > On Oct 11, 1:36 am, Romain Guy <romain...@google.com> wrote:
>
> > > It's not a bug, it's a message that was added to notify app developers
> > > of applications that are doing the wrong thing.
>
> > > > I'm sure my adapter mods are not in the UI thread.
>
> > > Which is exactly the problem.
>
> > > --
> > > 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- Hide quoted 
> > > text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to