"Android Frame Advanced 〖04〗" Mdevil's network module volley

Source: Internet
Author: User

For Android app Development, there are a lot of open source frameworks based on Web requests, and I like to use Asynchttpclient,universalimageloader. The original idea is to encapsulate a set of common request and return interface in the framework, then the project bottom no matter what framework for network requests, will not modify the business layer code, to achieve the separation of business and basic functions, convenient later optimization, expansion. Later with a friend Ali to talk about this piece, talking about the Android network request, feel a good application, especially the network request module, should have a set of their own things, and not with others, suddenly feel very reasonable, it is necessary to choose a set of their own network framework, easy to do after the boss:)

First think of some memory, power saving, thread pool and other key factors, and then gather some of the current open source framework, found that asynchttpclient is also a bug, and if with Asynchttpclient, for the ListView and other network requests, I have to introduce such as Universalimageloader to the image of the special treatment, before used volley, feel very good, no in-depth research, now research, found there are some problems, such as can not upload large files, no progress, but volley to  Android has done a lot of optimizations, do not support large file upload download is also a reason, such as set the priority of the scan thread, so that it is more power-saving, more than 2.2 and the following version of the network request to do a separate processing, 2.2 under the use of more than androidhttpclient,2.3 used HttpURLConnection, see http://blog.csdn.net/guolin_blog/article/details/12452307 for specific reasons. Think Android system is Google launched, volley is the Google engineers in the I/O conference launched, the most orthodox, then decided to study volley, expand volley.

Looking for two days, found that volley in the boot, cache the main thread of the Handler, then no matter in the main thread or sub-thread execution volley network request, return to execute Onresponse is the main thread in execution, this is one of the features, and then found that volley initialized when the open 5 scan threads, of which 1 cache scan threads, 4 non-cache scan threads, when adding a request, first check whether the cache is already there, and then return directly, or then execute the network request, here should be the optimization of the multi-picture request, volley see translation means "Million arrow qi FA", The implication is to load the picture like the million arrows to shoot as fast, late to see if you can get a download upload progress function, it is perfect.


"Android Frame Advanced 〖04〗" Mdevil's network module volley

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.