2013-07-04 11 views
13

Jaka jest funkcja Uri i jak jest używana Uri.parse()?Co to jest Uri.parse w Androidzie

Na przykład:

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

i

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

Co tel i geo patrz?

+1

http://developer.android.com/reference/android/net/Uri.html#parse(java.lang.String). sprawdź dokumenty – Raghunandan

+0

Według mojej wiedzy są to protokoły podobne do 'http' – Aswin

Odpowiedz

9

Obiekt jest zazwyczaj używany do informowania obiektu ContentProvider o tym, do czego chcemy uzyskać dostęp poprzez odniesienie. Jest to niezmienne mapowanie typu "jeden do jednego" do zasobu lub danych. Metoda Uri.parse tworzy nowy obiekt z prawidłowo sformatowanego obiektu String. Zobacz here, aby uzyskać więcej informacji na temat ContentProviders.

6

W przypadku, gdy chcesz konkretnej odpowiedzi na temat charakteru uriString że jest argumentem tutaj,
Od,
http://developer.android.com/reference/android/net/Uri.html#parse%28java.lang.String%29

niezmienne odniesienie URI. Odwołanie URI zawiera fragment URI i , będący składnikiem URI po znaku "#". Buduje i analizuje URI referencje, które są zgodne z RFC 2396.

i około standardu RFC 2396,
z,
http://www.faqs.org/rfcs/rfc2396.html

tej aktualizacji dokumentów i łączy "Uniform Resource Locator"
[RFC1738] i "Względne jednolite lokalizatory zasobów" [RFC1808] w celu zdefiniowania pojedynczej, ogólnej składni dla wszystkich URI.

I

1,1 Przegląd URI

URI charakteryzują się następującymi definicjami:

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. 

Oto niektóre w użyciu:

1.3. Przykład URI:

Poniższe przykłady ilustrują często używany URI.

ftp://ftp.is.co.za/rfc/rfc1808.txt - ftp program do przesyłania plików usług Protokołem

Gopher: //spinaltap.micro.umn.edu/00/Pogoda/Kalifornia/Los% 20Angeles - Gopher system dla usług Gopher i Gopher + Protokołem

http://www.math.uio.no/faq/compression-faq/part1.html - http schemat Hypertext Transfer usług Protokołem

mailto: [email protected] - mailto schemat adresów poczty elektronicznej

news: comp.infosystems.www.servers.unix - system wiadomością dla grup dyskusyjnych wiadomości i artykuły

telnet: //melvyl.ucop.edu/ - program telnet dla usług interaktywnych za pomocą protokołu TELNET

1

Uniform Resource Identifier (URI) to ciąg znaków używany do identyfikacji resource.A URI identyfikuje zasób albo według miejsca, albo nazwę lub obie . Taka identyfikacja umożliwia interakcję z reprezentacjami zasobów w sieci, zazwyczaj w sieci WWW, przy użyciu określonych protokołów. ex- URL to URI. * To, co jest Uri.parse() * , nie "parsuje", ale w rzeczywistości tworzy obiekt Uri, używając przekazanego do niego ciągu, a ciąg jest ukryty przed użytkownikiem. Teraz pytanie brzmi, co robi obiekt Uri? Obiekt URI jest więc niezmiennym odnośnikiem do URI, którego możemy użyć w odniesieniu do zasobów.