开发者

How to change a string to Uri

开发者 https://www.devze.com 2023-01-05 19:58 出处:网络
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:

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));
0

精彩评论

暂无评论...
验证码 换一张
取 消