listview resolves the flashing of the picture in item when the refresh occurs

Source: Internet
Author: User

Problem Description:

The listview item has a picture, and when refreshed, the new data and the old data are no different, ImageView will still flash.

First to analyze the possible causes of the picture flashing:

1) adapter = new Willlistadapter (Myapplication.getinstance (), wills);

Regardless of whether the previous adapter has been bound to data, or the data has not changed before and after this statement executes, adapter will make the ListView redraw all item, this flashing inevitable

2) adapter.notifydatasetchanged ();

If the item corresponds to a change in data, the item is redrawn and a flashing

3) ImageView asynchronous loading may be problematic, instead volley will not appear

Solve:

This only solves the situation where the data has not changed since the refresh, but flashes.

The error code for the refresh

adapter = new Willlistadapter (Myapplication.getinstance (), wills);

Switch

if (! Wills.isempty ()) {Wills.removeall (wills);} Wills.addall (Jsontools.getobjects (Httpresult.getresult (). ToString (), would. class ) ; adapter.notifydatasetchanged ();

Done

listview resolves the flashing of the picture in item when the refresh occurs

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.