Back
How can I convert a String to a Uri in Java (Android)? i.e.:
String myUrl = "http://stackoverflow.com";
myUri = ???
Use the parse method of uri, which is a static method and easy one-liner.
Uri myUri = Uri.parse("http://stackoverflow.com")
OR
Directly use java.net package
URI myURI = new URI(myUrl);
30.9k questions
32.9k answers
500 comments
665 users