博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android开发训练之第五章第七节——Transmitting Network Data Using Volley
阅读量:4992 次
发布时间:2019-06-12

本文共 13007 字,大约阅读时间需要 43 分钟。

Transmitting Network Data Using Volley

DEPENDENCIES AND PREREQUISITES

  • Android 1.6 (API Level 4) or higher

VIDEO

Volley: Easy, Fast Networking for Android

Volley is an HTTP library that makes networking for Android apps easier and most importantly, faster. Volley is available through the open  repository.

Volley offers the following benefits:

  • Automatic scheduling of network requests.
  • Multiple concurrent network connections.
  • Transparent disk and memory response caching with standard HTTP .
  • Support for request prioritization.
  • Cancellation request API. You can cancel a single request, or you can set blocks or scopes of requests to cancel.
  • Ease of customization, for example, for retry and backoff.
  • Strong ordering that makes it easy to correctly populate your UI with data fetched asynchronously from the network.
  • Debugging and tracing tools.

Volley excels at RPC-type operations used to populate a UI, such as fetching a page of search results as structured data. It integrates easily with any protocol and comes out of the box with support for raw strings, images, and JSON. By providing built-in support for the features you need, Volley frees you from writing boilerplate code and allows you to concentrate on the logic that is specific to your app.

Volley is not suitable for large download or streaming operations, since Volley holds all responses in memory during parsing. For large download operations, consider using an alternative like .

The core Volley library is developed in the open  repository at frameworks/volley and contains the main request dispatch pipeline as well as a set of commonly applicable utilities, available in the Volley "toolbox." The easiest way to add Volley to your project is to clone the Volley repository and set it as a library project:

  1. Git clone the repository by typing the following at the command line:
    git clone https://android.googlesource.com/platform/frameworks/volley
  2. Import the downloaded source into your app project as an Android library project (as described in , if you're using Eclipse) or make a .

Lessons


Learn how to send a simple request using the default behaviors of Volley, and how to cancel a request.
Learn how to set up a 
RequestQueue, and how to implement a singleton pattern to create a 
RequestQueue that lasts the lifetime of your app.
Learn how to send a request using one of Volley's out-of-the-box request types (raw strings, images, and JSON).
Learn how to implement a custom request.

转载于:https://www.cnblogs.com/bvin/p/4350731.html

你可能感兴趣的文章
ctci1.2
查看>>
[译]RabbitMQ教程C#版 - 路由
查看>>
升级项目到.NET Core 2.0,在Linux上安装Docker,并成功部署
查看>>
调用API函数减少c#内存占用(20+m减至1m以下)
查看>>
Android:onNewIntent()触发机制及注意事项
查看>>
珠宝公司之感想
查看>>
项目问题
查看>>
scss侦听并压缩
查看>>
我有接口文档, 你有酒吗?
查看>>
iOS - Push 通知推送
查看>>
[FJOI2007]轮状病毒
查看>>
Azure AADSTS7000215 其中一种问题的解决
查看>>
关于吃苦
查看>>
uva 1629切蛋糕(dp)
查看>>
生成awr报告
查看>>
cocos2d-x 3.0rc2 对于每个包执行情况的重要平台 (超级方便)
查看>>
Android 深入解析光传感器(二)
查看>>
Ansible@一个高效的配置管理工具--Ansible configure management--翻译(八)
查看>>
【bzoj4552/Tjoi2016&Heoi2016】排序——二分+线段树/平衡树+线段树分裂与合并
查看>>
Windows Internals学习笔记(八)IO系统
查看>>