Convert String to Uri

前端 未结 6 1567
余生分开走
余生分开走 2020-11-30 19:58

How can I convert a String to a Uri in Java (Android)? i.e.:

String myUrl = \"http://stackoverflow.com\";

myUri = ???;

6条回答
  •  有刺的猬
    2020-11-30 20:44

    I am just using the java.net package. Here you can do the following:

    String myUrl = "http://stackoverflow.com";
    URI myURI = new URI(myUrl);
    

提交回复
热议问题