Turning a string into a Uri in Android

前端 未结 2 1308
没有蜡笔的小新
没有蜡笔的小新 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));
    

提交回复
热议问题