How to change a string to Uri
I am getting (what I believe) is a string from my hashmap and need to return this from my method as a Uri in order to use it in a VideoView. Here is my method that gets the string from my hashmap:
public static Uri getVideoPath(String cond){
Log.d(DEB_TAG, "*********Inside of getVideoPath");
HashMap hm = createHashmap();
Log.d(DEB_TAG, "********Value of hm is " + hm.get(cond));
Uri tempPath = (Uri) hm.get(cond);
return tempPath;
}
I get a value for my "hm.get(con开发者_StackOverflow社区d)" of this "http://www.personal.psu.edu/tmv105/video/sunny/sunny.mp4" I get no value for "tempPath" which is the value that I am passing over to the call of this method like this: (mVid is my VideoView)
mPath = LayoutConditions.getVideoPath(wd.getCurrentIconCode());
mVid.setVideoURI(mPath);
mVid.requestFocus();
mVid.start();
Any ideas how I might handle this? Thanks in advance for any help provided!
Try this:
Uri tempPath = Uri.parse((String)hm.get(cond));
精彩评论