Turning a string into a Uri in Android

前端 未结 2 1307
没有蜡笔的小新
没有蜡笔的小新 2021-01-30 06:01

I have a string, \'songchoice\'. I want it to become a \'Uri\' so I can use with MediaPlayer.create(context, Uri)

How can I convert songchoice

相关标签:
2条回答
  • 2021-01-30 06:17
    Uri.parse(STRING);
    

    See doc:

    String: an RFC 2396-compliant, encoded URI

    Url must be canonicalized before using, like this:

    Uri.parse(Uri.decode(STRING));
    
    0 讨论(0)
  • 2021-01-30 06:30
    Uri myUri = Uri.parse("http://www.google.com");
    

    Here's the doc http://developer.android.com/reference/android/net/Uri.html#parse%28java.lang.String%29

    0 讨论(0)
提交回复
热议问题