Android Error: The content of the adapter has changed ...

Source: Internet
Author: User

The content of the adapter has changed but the ListView does not receive a notification. Make sure the content of your adapter are not modified from a background thread, but only from the UI thread.

Analysis:

This error is often the case that a ListView and other controls may pass in a static list when using the adapter adaptation data, and use the = sign directly in the adapter to assign a value. When the external list is changed (such as multi-threaded operation of this list) did not timely call adapter notifydatasetchanged, causing the next time to update the error.

Solve:

In adapter, do not use the = sign directly to assign a value, using the following two ways to reallocate memory:

1:list.clear, List.addall.

2:arraylist.clone.

Android Error: The content of the adapter has changed ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.