Home | History | Annotate | Download | only in volley
      1 page.title=Transmitting Network Data Using Volley
      2 page.tags=""
      3 
      4 trainingnavtop=true
      5 startpage=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 2.2 (API Level 8) or higher</li>
     21 </ul>
     22 
     23 </div>
     24 </div>
     25 
     26 <a class="notice-developers-video wide" href="https://www.youtube.com/watch?v=yhv8l9F44qo">
     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,
     35 faster. 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
     48 scopes 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
     51 asynchronously 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
     57 search results as structured data. It integrates easily with any protocol and comes out of
     58 the box with support for raw strings, images, and JSON. By providing built-in support for
     59 the features you need, Volley frees you from writing boilerplate code and allows you to
     60 concentrate 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
     62 all responses in memory during parsing. For large download operations, consider using an
     63 alternative 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>
     67 repository at {@code frameworks/volley} and contains the main request dispatch pipeline
     68 as well as a set of commonly applicable utilities, available in the Volley "toolbox." The
     69 easiest way to add Volley to your project is to clone the Volley repository and set it as
     70 a library project:</p>
     71 
     72 <ol>
     73 <li>Git clone the repository by typing the following at the command line:
     74 
     75 <pre>
     76 git 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 module
     81 as described in <a
     82 href="{@docRoot}studio/projects/android-library.html">Create an Android Library</a>.</li>
     83 </ol>
     84 
     85 <h2>Lessons</h2>
     86 
     87 <dl>
     88  <dt>
     89         <strong><a href="simple.html">Sending a Simple Request</a></strong>
     90     </dt>
     91     <dd>
     92         Learn how to send a simple request using the default behaviors of Volley, and how
     93         to cancel a request.
     94 
     95     </dd>
     96     <dt>
     97         <strong><a href="requestqueue.html">Setting Up a RequestQueue</a></strong>
     98     </dt>
     99     <dd>
    100         Learn how to set up a {@code RequestQueue}, and how to implement a singleton
    101         pattern to create a {@code RequestQueue} that lasts the lifetime of your app.
    102     </dd>
    103     <dt>
    104         <strong><a href="request.html">Making a Standard Request</a></strong>
    105     </dt>
    106     <dd>
    107         Learn how to send a request using one of Volley's out-of-the-box request types
    108         (raw strings, images, and JSON).
    109     </dd>
    110     <dt>
    111         <strong><a href="request-custom.html">Implementing a Custom Request</a></strong>
    112     </dt>
    113     <dd>
    114         Learn how to implement a custom request.
    115     </dd>
    116 
    117 </dl>
    118