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 adapter is not modified from a
background thread, but only "
+ "from the UI thread.");
}
(it is a quote from sources ListView.java) and only in this case.
Thus, if number of elements wasn't changed, everything is ok.
On 15 окт, 16:47, Alexey <goalstu...@gmail.com> wrote:
> 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. As I understood
> > modifying adapter should be done in workerthreadand only
> > notifyDataSetChanged in UIthread.
> > Now as I see the concept is different, but what if we need to add
> > several hundred items into adapter, won't UIthreadbe in freeze for
> > this time?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---
Subscribe to:
Post Comments (Atom)
Hi
ReplyDeleteI got this Exception using a ListView.
My ListView is filled insied the onCreate. 5 items.
When I clic on an item, it's allways OK.
When I change screen orientation, and clic on an item I allways get this Exception.
Any help would be appreciated !
bsegonnes at free . fr