What is Uri.parse in android

后端 未结 4 1477
谎友^
谎友^ 2021-02-02 14:32

What is the function of Uri and how is Uri.parse() used?

For example :

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

an

相关标签:
4条回答
  • 2021-02-02 14:47

    The "tel:" and "geo:" are called Data schemes in android it tells the intent what application are you looking for

    eg- if you use tel: it will tell the android system that you are looking for callling applicaion and it will open all the calling applications.If you use geo: it will tell androdid system that you are looking for a map or location app eg the google maps

    0 讨论(0)
  • 2021-02-02 14:53

    Uniform Resource Identifier (URI) is a string of characters used to identify a resource.A URI identifies a resource either by location, or a name, or both. Such identification enables interaction with representations of the resource over a network, typically the World Wide Web, using specific protocols. ex- a URL is a URI. * What is Uri.parse()* it does not 'parse'but it actually creates a Uri object, using the string passed to it and the string is hidden from the user. Now the question is what does the Uri object do?? So the URI object is an immutable reference to a URI which we can use to refer to resources .

    0 讨论(0)
  • 2021-02-02 15:03

    A Uri object is usually used to tell a ContentProvider what we want to access by reference. It is an immutable one-to-one mapping to a resource or data. The method Uri.parse creates a new Uri object from a properly formated String. See here for more information about ContentProviders.

    0 讨论(0)
  • 2021-02-02 15:13

    1.1 Overview of URI

    URI are characterized by the following definitions:

      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.
    

    Here are some in use:

    1.3. Example URI

    The following examples illustrate URI that are in common use.

    ftp://ftp.is.co.za/rfc/rfc1808.txt -- ftp scheme for File Transfer Protocol services

    gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles -- gopher scheme for Gopher and Gopher+ Protocol services

    http://www.math.uio.no/faq/compression-faq/part1.html -- http scheme for Hypertext Transfer Protocol services

    mduerst@ifi.unizh.ch -- mailto scheme for electronic mail addresses

    news:comp.infosystems.www.servers.unix -- news scheme for USENET news groups and articles

    telnet://melvyl.ucop.edu/ -- telnet scheme for interactive services via the TELNET Protocol

    References:

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

    0 讨论(0)
提交回复
热议问题