[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-19 Thread Alexey
On 16 окт, 20:10, Romain Guy romain...@google.com wrote: (it is a quote from sources ListView.java) and only in this case. Thus,  if number of elements wasn't changed, everything is ok. Thanks, Sergey. If you modify the adapter without changing the number of items it can also be bad.

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-19 Thread Romain Guy
There's no performance issue: you do all the work on a background thread and then you add everything in the adapter on the UI thread. A simple loop to add() several hundreds elements should not freeze the UI. On Oct 19, 2009 2:49 AM, Alexey goalstu...@gmail.com wrote: On 16 окт, 20:10, Romain

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-19 Thread Alexey
Thanks, Romain, I will try... On 19 окт, 14:00, Romain Guy romain...@google.com wrote: There's no performance issue: you do all the work on a background thread and then you add everything in the adapter on the UI thread. A simple loop to add() several hundreds elements should not freeze the

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-16 Thread Sergey Vasilinets
Alexey, ListView chashes in case of: if (mItemCount != mAdapter.getCount()) { throw new IllegalStateException(The content of the adapter has changed but + ListView did not receive a notification. Make sure the content of + your

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-16 Thread Romain Guy
(it is a quote from sources ListView.java) and only in this case. Thus,  if number of elements wasn't changed, everything is ok. If you modify the adapter without changing the number of items it can also be bad. It's just that ListView does not detect this case. On 15 окт, 16:47, Alexey

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-15 Thread Alexey
Romain, your answers are clear, but confusing. As I understood modifying adapter should be done in worker thread and only notifyDataSetChanged in UI thread. Now as I see the concept is different, but what if we need to add several hundred items into adapter, won't UI thread be in freeze for this

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-15 Thread Alexey
Romain, one more question. Is this rule applicable for adding/removing elements from adapter (in other words - changing number of elements in ListView) or also when changing content of elements? On 15 окт, 16:31, Alexey goalstu...@gmail.com wrote: Romain, your answers are clear, but confusing.

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-12 Thread Moto
Same issue here! Thanks for the information! -Moto! On Oct 11, 3:11 pm, ccfrazier2 georgefraz...@yahoo.com wrote: Romain, Fantastic, thanks for the help! I've had customers contact me over the months about force closes that I can never get to the bottom of. This likely has fixed the

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-12 Thread Sergey Vasilinets
That's a possibility. You could also just use a CursorAdapter I had also this error, and I used SimpleCursorAdapter, that's why i think, it isn't solution of the problem. ccfrazier2, Try to frequently select items, while list is adding new elements, error may be repeated(may be not). ( if you

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-12 Thread Sergey Vasilinets
That's a possibility. You could also just use a CursorAdapter I also had this error, and I used SimpleCursorAdapter, that's why i think, it isn't solution of the problem. ccfrazier2, Try to frequently select items, while list is adding new elements, error may be repeated(may be not). ( if

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-11 Thread Romain Guy
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

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-11 Thread ccfrazier2
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

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-11 Thread RichardC
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,

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-11 Thread ccfrazier2
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)

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-11 Thread Romain Guy
-- myArrayList.add(i, new CalStats(name, extra, calories)); if that's the array list used by your adapter then you are modifying it outside of the UI thread. On Sun, Oct 11, 2009 at 11:07 AM, ccfrazier2 georgefraz...@yahoo.com wrote: Yeah, it's the main thread of my app, here's the stack:

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-11 Thread ccfrazier2
Thanks so much for the replies. Maybe I've been doing this wrong all along, I have 6 activites that use this same methodology, but YES, I guess this is the array used by the adapter (code below shows that is is). In my background thread if I add 100 elements to the array, everything works

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-11 Thread Mark Murphy
ccfrazier2 wrote: Thanks so much for the replies. Maybe I've been doing this wrong all along, I have 6 activites that use this same methodology, but YES, I guess this is the array used by the adapter (code below shows that is is). In my background thread if I add 100 elements to the

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-11 Thread Romain Guy
In my background thread if I add 100 elements to the array, everything works great. If I add more than 300 though I get the crash. Is this capacity related. No, this is related to the use of threads. Even adding 1 element could cause the crash. You just cannot really predict the behavior.

[android-developers] Re: ListView/Adapter Crash in 1.6 only: illegalStateException. 1.6 bug?

2009-10-11 Thread ccfrazier2
Romain, Fantastic, thanks for the help! I've had customers contact me over the months about force closes that I can never get to the bottom of. This likely has fixed the lingering issues. Great news! Thanks, pawpaw17 On Oct 11, 2:08 pm, Romain Guy romain...@google.com wrote: In my background