Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is an URI in android

Tags:

android

I have recently come across an android object that makes no sense to me. I can't understand what is an URI?

Well I checked the Official Documentation and it said:

Immutable URI reference. A URI reference includes a URI and a fragment, the component of the URI following a '#'. Builds and parses URI references which conform to RFC 2396.

The problem is, you can't use a URI to explain what is a URI! I am totally confused.

I did some research and came across this article. But it said

Uri does nothing

Could someone please explain to me what does this mean!

like image 806
Fish Avatar asked Jul 24 '15 00:07

Fish


People also ask

Why do we use URI in Android?

Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted below, an instance of this class represents a URI reference as defined by RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax, amended by RFC 2732: Format for Literal IPv6 Addresses in URLs.

Is URI a string?

A URI is short for Uniform Resource Identifier. This URI is a string that contains 1. The URL you are pointing towards, 2.


2 Answers

  1. Q: What is a "URI"?

    A: The technical meaning of "URI" is defined in RFC 2396:

A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource.

  1. Q: What is an Android "URI" class?

    A: Here is the Javadoc for android.net.Uri

  2. Q: But what do we need the Android "URI" class for?

    A: Look at the "Content Providers" section of the Android documentation:

http://developer.android.com/guide/topics/providers/content-providers.html

Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security. Content providers are the standard interface that connects data in one process with code running in another process.

For example...

public final ContentProviderClient acquireContentProviderClient (Uri uri)

Returns a ContentProviderClient that is associated with the ContentProvider that services the content at uri, starting the provider if necessary.

If you're curious, here's what Tim Berners-Lee had to say about URIs (he's the guy who invented them ;)):

http://www.w3.org/DesignIssues/Axioms.html#uri

Universal Resource Identifiers

The Web is a universal information space. It is a space in the sense that things in it have an address. The "addresses", "names", or as we call them here identifiers, are the subject of this article. They are called Universal Resource Identifiers (URIs).

An information object is "on the web" if it has a URI. Objects which have URIs are sometimes known as "First Class Objects" (FCOs). The Web works best when any information object of value and identity is a first class object. If something does not have a URI, you can't refer to it, and the power of the Web is the less for that.

By Universal I mean that the web is declared to be able to contain in principle every bit of information accessible by networks. It was designed to be able to include existing information systems such as FTP, and to be able simply in the future to be extendable to include any new information system.

The URI schemes identify things various different types of information object, wich play different roles in the protocols. Some identify services, connection end points, and so on, but a fundamental underlying architectural notion is of information objects - otherwise known as generic documents. These can be represented by strings of bits. An information object conveys something - it may be art, poetry, sensor values or mathematical equations.

like image 169
paulsm4 Avatar answered Oct 10 '22 09:10

paulsm4


URI(Uniform resource identifier) as its name suggests is used to identify resource(whether it be a page of text, a video or sound clip, a still or animated image, or a program).

The most common form of URI is the Web page address, which is a particular form or subset of URI called a Uniform Resource Locator (URL).

Android uses URI string as the basis for requesting data in a content provider (i.e. to retrieve a list of contacts) and for requesting actions (i.e. opening a webpage in a browser)

like image 4
Anand Prakash Avatar answered Oct 10 '22 11:10

Anand Prakash