Turning a string into a Uri in Android

James Andrew picture James Andrew · Apr 25, 2010 · Viewed 145.2k times · Source

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 to the Uri?

Answer

user132014 picture user132014 · Apr 25, 2010
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