20

它的功能是什么Uri以及如何Uri.parse()使用?

例如 :

Uri.parse("tel:(+49)12345789"));

Uri.parse("geo:50.123,7.1434?z=19"));

做什么telgeo指什么?

4

4 回答 4

11

Uri对象通常用于告诉ContentProvider我们想通过引用访问什么。它是到资源或数据的不可变的一对一映射。该方法从正确格式化Uri.parse的. 有关. _ _UriStringContentProviders

于 2013-07-04T10:34:25.563 回答
11

1.1 URI概述

URI 具有以下定义:

  Uniform
     Uniformity provides several benefits: it allows different types
     of resource identifiers to be used in the same context, even
     when the mechanisms used to access those resources may differ;
     it allows uniform semantic interpretation of common syntactic
     conventions across different types of resource identifiers; it
     allows introduction of new types of resource identifiers
     without interfering with the way that existing identifiers are
     used; and, it allows the identifiers to be reused in many
     different contexts, thus permitting new applications or
     protocols to leverage a pre-existing, large, and widely-used
     set of resource identifiers.

  Resource
     A resource can be anything that has identity.  Familiar
     examples include an electronic document, an image, a service
     (e.g., "today's weather report for Los Angeles"), and a
     collection of other resources.  Not all resources are network
     "retrievable"; e.g., human beings, corporations, and bound
     books in a library can also be considered resources.

     The resource is the conceptual mapping to an entity or set of
     entities, not necessarily the entity which corresponds to that
     mapping at any particular instance in time.  Thus, a resource
     can remain constant even when its content---the entities to
     which it currently corresponds---changes over time, provided
     that the conceptual mapping is not changed in the process.

  Identifier
     An identifier is an object that can act as a reference to
     something that has identity.  In the case of URI, the object is
     a sequence of characters with a restricted syntax.

以下是一些正在使用的:

1.3. 示例 URI

以下示例说明了常用的 URI。

ftp://ftp.is.co.za/rfc/rfc1808.txt -- 文件传输协议服务的 ftp 方案

gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles -- 用于 Gopher 和 Gopher+ 协议服务的 gopher 方案

http://www.math.uio.no/faq/compression-faq/part1.html -- 超文本传输​​协议服务的 http 方案

mduerst@ifi.unizh.ch -- 电子邮件地址的 mailto 方案

news:comp.infosystems.www.servers.unix -- USENET 新闻组和文章的新闻方案

telnet://melvyl.ucop.edu/ -- 通过 TELNET 协议进行交互服务的 telnet 方案

参考:

http://www.faqs.org/rfcs/rfc2396.html

于 2015-05-04T05:40:44.603 回答
6

统一资源标识符 (URI) 是用于标识资源的字符串。URI 通过位置或名称或两者来标识资源。这样的识别能够使用特定协议通过网络(通常是万维网)与资源的表示进行交互。例如,一个 URL 是一个 URI。 * 什么是 Uri.parse()* 它不“解析”,但它实际上创建了一个 Uri 对象,使用传递给它的字符串并且该字符串对用户隐藏。现在的问题是 Uri 对象做什么?所以 URI 对象是对 URI 的不可变引用,我们可以使用它来引用资源。

于 2016-07-04T19:04:51.107 回答
2

tel:”“geo:”在android中被称为数据方案,它告诉意图你在寻找什么应用程序

例如 - 如果您使用 tel:它会告诉 android 系统您正在寻找呼叫应用程序,它将打开所有呼叫应用程序。如果您使用 geo:它会告诉 android 系统您正在寻找地图或位置应用程序,例如谷歌地图

于 2020-05-07T12:19:42.080 回答