Convert String to Uri

前端 未结 6 1592
余生分开走
余生分开走 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:37

    What are you going to do with the URI?

    If you're just going to use it with an HttpGet for example, you can just use the string directly when creating the HttpGet instance.

    HttpGet get = new HttpGet("http://stackoverflow.com");
    

提交回复
热议问题