什么是Android中的Uri.parse

时间:2013-07-04 10:19:26

标签: android android-intent

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

例如:

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

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

telgeo指的是什么?

4 个答案:

答案 0 :(得分:9)

Uri对象通常用于通过引用告诉ContentProvider我们想要访问的内容。它是对资源或数据的不可变的一对一映射。方法Uri.parse从正确格式化的Uri创建新的String对象。有关ContentProviders

的详情,请参阅here

答案 1 :(得分:9)

如果您想要了解uriString这一论点的性质的具体答案,
来自,
http://developer.android.com/reference/android/net/Uri.html#parse%28java.lang.String%29

  

不可变的URI引用。 URI引用包括URI和   fragment,'#'后面的URI组件。构建和解析   符合RFC 2396的URI引用。

关于 RFC 2396 标准,
从,
http://www.faqs.org/rfcs/rfc2396.html

  

本文档更新并合并“统一资源定位器”
  [RFC1738]和“相对统一资源定位符”[RFC1808]按顺序排列   为所有URI定义单个通用语法。

和,

  

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方案

     

的mailto:mduerst@ifi.unizh.ch          - 电子邮件地址的mailto计划

     

消息:comp.infosystems.www.servers.unix          - USENET新闻组和文章的新闻计划

     

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

答案 2 :(得分:3)

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

答案 3 :(得分:1)

“电话:” “ geo:” 在android中称为Data schemes,它告诉您要查找的应用程序

例如-如果您使用tel:它将告诉android系统您正在寻找callling应用程序,并且它将打开所有正在调用的应用程序。如果您使用geo:它会告诉androdid系统您正在寻找地图或定位应用,例如Google地图

相关问题