1page.title=Transmitting Network Data Using Volley
2page.tags=""
3
4trainingnavtop=true
5startpage=true
6
7
8@jd:body
9
10
11
12<div id="tb-wrapper">
13<div id="tb">
14
15
16<!-- Required platform, tools, add-ons, devices, knowledge, etc. -->
17<h2>Dependencies and prerequisites</h2>
18
19<ul>
20  <li>Android 1.6 (API Level 4) or higher</li>
21</ul>
22
23</div>
24</div>
25
26<a class="notice-developers-video wide" href="https://developers.google.com/events/io/sessions/325304728">
27<div>
28    <h3>Video</h3>
29    <p>Volley: Easy, Fast Networking for Android</p>
30</div>
31</a>
32
33
34<p>Volley is an HTTP library that makes networking for Android apps easier and most importantly,
35faster. Volley is available through the open
36<a href="https://android.googlesource.com/platform/frameworks/volley">AOSP</a> repository.</p>
37
38<p>Volley offers the following benefits:</p>
39
40<ul>
41
42<li>Automatic scheduling of network requests.</li>
43<li>Multiple concurrent network connections.</li>
44<li>Transparent disk and memory response caching with standard HTTP
45<a href=http://en.wikipedia.org/wiki/Cache_coherence">cache coherence</a>.</li>
46<li>Support for request prioritization.</li>
47<li>Cancellation request API. You can cancel a single request, or you can set blocks or
48scopes of requests to cancel.</li>
49<li>Ease of customization, for example, for retry and backoff.</li>
50<li>Strong ordering that makes it easy to correctly populate your UI with data fetched
51asynchronously from the network.</li>
52<li>Debugging and tracing tools.</li>
53
54</ul>
55
56<p>Volley excels at RPC-type operations used to populate a UI, such as fetching a page of
57search results as structured data. It integrates easily with any protocol and comes out of
58the box with support for raw strings, images, and JSON. By providing built-in support for
59the features you need, Volley frees you from writing boilerplate code and allows you to
60concentrate on the logic that is specific to your app.</p>
61<p>Volley is not suitable for large download or streaming operations, since Volley holds
62all responses in memory during parsing. For large download operations, consider using an
63alternative like {@link android.app.DownloadManager}.</p>
64
65<p>The core Volley library is developed in the open
66<a href="https://android.googlesource.com/platform/frameworks/volley">AOSP</a>
67repository at {@code frameworks/volley} and contains the main request dispatch pipeline
68as well as a set of commonly applicable utilities, available in the Volley "toolbox." The
69easiest way to add Volley to your project is to clone the Volley repository and set it as
70a library project:</p>
71
72<ol>
73<li>Git clone the repository by typing the following at the command line:
74
75<pre>
76git clone https://android.googlesource.com/platform/frameworks/volley
77</pre>
78</li>
79
80<li>Import the downloaded source into your app project as an Android library project
81(as described in <a href="{@docRoot}tools/projects/projects-eclipse.html">
82Managing Projects from Eclipse with ADT</a>, if you're using Eclipse) or make a
83<a href="{@docRoot}guide/faq/commontasks.html#addexternallibrary"><code>.jar</code> file</a>.</li>
84</ol>
85
86<h2>Lessons</h2>
87
88<dl>
89 <dt>
90        <strong><a href="simple.html">Sending a Simple Request</a></strong>
91    </dt>
92    <dd>
93        Learn how to send a simple request using the default behaviors of Volley, and how
94        to cancel a request.
95
96    </dd>
97    <dt>
98        <strong><a href="requestqueue.html">Setting Up a RequestQueue</a></strong>
99    </dt>
100    <dd>
101        Learn how to set up a {@code RequestQueue}, and how to implement a singleton
102        pattern to create a {@code RequestQueue} that lasts the lifetime of your app.
103    </dd>
104    <dt>
105        <strong><a href="request.html">Making a Standard Request</a></strong>
106    </dt>
107    <dd>
108        Learn how to send a request using one of Volley's out-of-the-box request types
109        (raw strings, images, and JSON).
110    </dd>
111    <dt>
112        <strong><a href="request-custom.html">Implementing a Custom Request</a></strong>
113    </dt>
114    <dd>
115        Learn how to implement a custom request.
116    </dd>
117
118</dl>
119