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 ther
uri = Uri.parse(mFile.toString());
http://developer.android.com/reference/android/net/Uri.html#parse(java.lang.String)
public static Uri parse (String uriString)
Creates a Uri which parses the given encoded URI string.
Parameters
uriString: an RFC 2396-compliant, encoded URIReturns
Uri for this given uri stringThrows
NullPointerException if uriString is null
Therefore, here is an example:
android.net.Uri.parse(new java.net.URI("").toString());
Goes without saying, use the real java.net.URI
in it... ;)
For anyone coming across this, I had success with the following code:
URI oldUri;
Uri newUri = new Uri.Builder().scheme(oldUri.getScheme())
.encodedAuthority(oldUri.getRawAuthority())
.encodedPath(oldUri.getRawPath())
.query(oldUri.getRawQuery())
.fragment(oldUri.getRawFragment())
.build();
Basically, get each URI component and pass it to the builder (as there does not seem to be a way to pass in a whole URI string.