Android Sub-thread refreshes the main thread in view

Source: Internet
Author: User

Recently encountered a problem, the ListView item loads multiple pictures, and the picture is loaded asynchronously through a child thread in the adapter GetView method.

This time involves the child thread refreshes the main thread in the view problem, generally there are two ways,

1.view.post (Runnable);

2.activity.runonuithread (Runnable);

The first is to use the View.post method to refresh the interface, but has failed to refresh, debug found that the image download has been successful, the View.post method has been called, but the image refresh has not been successful.

Very puzzled, so add log to see a bit, found that the Runnable method has not been called, very strange, but because the project is too tense, temporarily did not investigate the reason, replaced by the second way to refresh,

Activity.runonuithread (), download success log print out after the interface immediately refreshed, temporarily recorded, in the future to find specific reasons.

Android Sub-thread refreshes the main thread in view

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.