Besides the fact that you must use it instead of the regular URI class
with the Android frameworks, it has a number of significant
differences, including:

- It is much more efficient, the API has been designed so that it
doesn't need to decode and re-encode the URI each time changes are
made to it (common when you are doing things like adding an ID to the
end of a content provider URI).

- When you send a Uri across processes, it sends its parsed
representation, instead of having to convert it to an encoded string
and re-parse it on the other side.

- It provides direct access to the segments of a path, which is used a
lot when content providers are parsing the URIs given to them.

- It never throws exceptions about bad URIs; instead it parses as much
as it can, and if you turn it back into a string it will generate the
original malformed URI.  This is very useful for the web browser,
which needs to deal with various poorly formed URIs but still be able
to submit them to the system to launch an activity.

On Apr 8, 9:36 am, "Harsh Jain" <[EMAIL PROTECTED]> wrote:
> IMO, you cant. For instance, ContentObservers/Resolvers works only with
> android.net.Uri.
>
> regards,
> harsh
>
> On Tue, Apr 8, 2008 at 10:03 PM, Anil <[EMAIL PROTECTED]> wrote:
>
> > To keep code portable, I wanted to use java.net.url. However I was
> > wondering if android.net.uri has
> > any advantages.
> > Apart from the encode and decode methods, is there an advantage?
> >http://code.google.com/android/reference/android/net/Uri.html
> > thanks,
> > Anil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to