Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert java.net.URI to android.net.Uri

Tags:

People also ask

What is the format of 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.

What is Java Net URI?

What is URI? URI stands for Uniform Resource Identifier. A Uniform Resource Identifier is a sequence of characters used for identification of a particular resource. It enables for the interaction of the representation of the resource over the network using specific protocols.

What is Uri parse in android?

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 .


I am able to find how to convert android.net.Uri to Java.net.URI here but not vice-versa.

So after spending some time I figured it out. Here is the solution(If there is another solution then please post that as well)

First convert javaURI to string and then use android.net.Uri's parse function

android.net.URI androidUri = android.net.Uri.parse(javaURI.toString());