Android HTTP Framework Volley learning:

Source: Internet
Author: User

Volley download

    1. git clone Https://android.googlesource.com/platform/frameworks/volley
after the introduction of the project can be downloaded, volley suitable for small data but continuous communication, as for the download file support is not very good, it is recommended to use Android Downloadmanager,.Android networking requires network permissions, and the memory card read and Write permissions are not missing ... volley the most in the volley.class,stringrequest,jsonrequest,imagerequest. Of course you can do it yourself. Inherit request<t>. Custom Volley.class are also required for general development in the project. For example, custom On-disk cache directory, useragent, can modify volley original project's files, or custom Myvolley. two ways to choose by yourself. get the source code of Baidu homepage
Stringrequest  request = new Stringrequest (host, New listener<string> () {@Overridepublic void Onresponse ( String response) {Logg.logg ("Request runs successfully");//Output results ..... Logg.logg (Response)}, new Response.errorlistener () {@Overridepublic void Onerrorresponse (volleyerror error) {                     Logg.logg ("Request error Run");}); Queue.add (request); Queue.start ();
Get JSON
Jsonobjectrequest objectrequest = new Jsonobjectrequest (JSON, NULL, new response.listener<jsonobject> () {@ overridepublic void Onresponse (jsonobject response) {Logg.logg (response.tostring ());}}, NULL); Queue.add ( Objectrequest); Queue.start ();
Load pictures from the network do not use ImageView, but to use Networkimageview. and to achieve imagecache. Suggestions.
The POST request needs to be rewritten in the Stringrequest GetParam method, Demo: http://download.csdn.net/detail/u014781439/8324529


Android HTTP Framework Volley learning:

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.