2010-07-07 80 views
0

我得到(我相信)是我的散列表中的一个字符串,并且需要从我的方法中以Uri的形式返回,以便在VideoView中使用它。这里是我的方法是从我的HashMap获取字符串:如何将字符串更改为Uri

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; 
    } 

为我的价值“hm.get(条件)”这个“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(); 

任何想法,我可以如何处理这个?预先感谢您提供的任何帮助!

回答

5

试试这个:

Uri tempPath = Uri.parse((String)hm.get(cond)); 
+0

作品令人难以置信!谢谢! :) – taraloca 2010-07-07 13:13:36

+0

非常欢迎:) – xil3 2010-07-07 13:24:30