执行网络操作概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本部分中的指南介绍了下述操作中所涉及的基本任务:连接到网络、监控网络连接(包括连接更改)以及让用户控制应用的网络使用情况。还介绍了如何解析和使用 XML 数据。
以下指南介绍了一些基本要素,有助于打造能够高效下载内容和解析数据的 Android 应用,同时最大限度地减少网络流量。
如需详细了解此主题,请参阅以下相关指南:
指南
- 连接到网络
- 了解如何连接到网络,选择 HTTP 客户端,以及在界面线程外部执行网络操作。
- 管理网络使用情况
- 了解如何查看设备的网络连接,创建用于控制网络使用情况的偏好设置界面,以及响应连接更改。
- 解析 XML 数据
- 了解如何解析和使用 XML 数据。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-26。"],[],[],null,["# Perform network operations overview\n\nThe guides in this section explain the basic tasks involved in connecting to the\nnetwork, monitoring the network connection (including connection changes), and\ngiving users control over an app\\\\'s network usage. They also describe how to\nparse and consume XML data.\n\nThese guides describe the fundamental building blocks for creating Android\napplications that download content and parse data efficiently while minimizing\nnetwork traffic.\n\nTo learn more about this topic, see the following related guides:\n\n- [Reduce network battery drain: Overview](/develop/connectivity/preserving-battery)\n- [Minimize the effect of regular updates](/develop/connectivity/minimize-effect-regular-updates)\n- [Web-based content](/guide/webapps)\n\nGuides\n------\n\n**[Connect to the network](/develop/connectivity/network-ops/connecting)**\n: Learn how to connect to the network, choose an HTTP client, and perform\n network operations outside of the UI thread.\n\n**[Manage network usage](/develop/connectivity/network-ops/managing)**\n: Learn how to check a device\\\\'s network connection, create a preference UI\n for controlling network usage, and respond to connection changes.\n\n**[Parse XML data](/develop/connectivity/network-ops/xml)**\n: Learn how to parse and consume XML data."]]