Android 4.0 main thread access network issues

Source: Internet
Author: User

Under 4.0, in the main thread to visit the network, if the request is more than 6s, it will report the ANR, then this will bring a problem, if the network is slow or the requested data is too large, the interface will be Kaka, resulting in very poor interface sensitivity, so the network request can not be placed in the main thread operation, Google in 4.0 when the adjustment, generally in the main thread to request the network, will be error, so that we have these programs apes have to start the sub-thread to network network, assuming 4.0 in the main thread to operate the network error messages such as the following:

<span style= "color: #ff6666;" >10-19 12:14:44.656:e/androidruntime (30444): caused by:android.os.networkonmainthreadexception</span>




Android 4.0 main thread access network issues

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.