Android Open Source Learning Volley

Source: Internet
Author: User

Note the points in your study:

1. To join the Internet permission in Androidmanifest.xml

<uses-permission android:name= "Android.permission.INTERNET"/>

2, suitable for the use of single-case design mode, reduce duplication of code

Mysingleton.java

public class Mysingleton {private static Mysingleton minstance;private requestqueue mrequestqueue;private imageloader Mimageloader;private static context Mctx; @SuppressLint ("Newapi") private Mysingleton (context context) {Mctx = context; Mrequestqueue = Getrequestqueue (); mimageloader = new Imageloader (mrequestqueue,new Imagecache () {Private final LruCache <string,bitmap>cache = new lrucache<string,bitmap>, @TargetApi (build.version_codes. HONEYCOMB_MR1) @SuppressLint ("Newapi") @Overridepublic void Putbitmap (String url, Bitmap Bitmap) {cache.put (URL, Bitmap );} @Overridepublic Bitmap getbitmap (String URL) {return cache.get (URL);}});} public static synchronized Mysingleton getinstance (context context) {if (minstance = = null) {minstance = new Mysingleton ( context);} return minstance;} Public Requestqueue Getrequestqueue () {if (Mrequestqueue = = null) {//Getapplicationcontext () is key, it keeps you from leak ing the//Activity or broadcastreceiver if someone passes one in.mrequestqueUE = Volley.newrequestqueue (Mctx.getapplicationcontext ());} return mrequestqueue;} Public <T> void Addtorequestqueue (request<t> req) {getrequestqueue (). Add (req);} Public Imageloader Getimageloader () {return mimageloader;}}


Official Learning Website:

Http://developer.android.com/training/volley (often not open)

Http://www.cnblogs.com/bvin/p/4350731.html (official excerpt from the blogger)

Share Summary:

http://blog.csdn.net/guolin_blog/article/details/17482095 (Volley fully parse one ~ four)

http://blog.csdn.net/chenfuduo_loveit/article/details/41773607 (translated by Bo)

http://codekk.com/open-source-project-analysis/detail/Android/grumoon/Volley%20%E6%BA%90%E7%A0%81%E8%A7%A3%E6% 9e%90 (source parsing of Codekk)



Android Open Source Learning 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.