2010-07-07 96 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