如何将字符串更改为 Uri
我得到的(我相信的)是来自我的哈希映射的字符串,并且需要从我的方法中将其作为 Uri 返回,以便在 VideoView 中使用它。这是我从哈希图中获取字符串的方法:
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;
}
我得到了这个“http://www.personal.psu.edu/tmv105/video/sunny/sunny.mp4" 我没有得到“tempPath”的值,这是我传递给此方法调用的值如下:(mVid 是我的 VideoView)
mPath = LayoutConditions.getVideoPath(wd.getCurrentIconCode());
mVid.setVideoURI(mPath);
mVid.requestFocus();
mVid.start();
我有什么想法可以处理这个问题吗?预先感谢您提供的任何帮助!
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(cond)" 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: