Android Asynchronous Network Connection Open Source: Android Asynchronous Http Client

Source: Internet
Author: User

I used James Smith's samrtImageView component before and found it useful. On his github, I found an Android Asynchronous Http Client, which is also good. I will introduce it to you here. The android built-in apache httpClient is executed asynchronously. The http request is outside the UI thread and encapsulates get/post. It supports multi-file upload and has a small size, optimized for mobile network connection, smart automatic request enrichment, automatic gzip, binary file download, built-in response parsed into json, and persistent cookie storage. Many projects and development programs are in use, such as the famous photo sharing software Instagram.

 

Install and use: download the latest jar package on the author page and put it in the libs directory of the program.

Create a new AsyncHttpClient instance and submit a request:


AsyncHttpClient client = new AsyncHttpClient ();
Client. get ("http://www.google.com", new AsyncHttpResponseHandler (){
@ Override
Public void onSuccess (String response ){
System. out. println (response );
}
});


No, it's that simple.

 


 

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.