2010-07-07 6 views
0

Je reçois (ce que je crois) une chaîne de ma hashmap et j'ai besoin de la renvoyer de ma méthode en Uri pour l'utiliser dans un VideoView. Voici ma méthode qui obtient la chaîne de mon hashmap:Comment changer une chaîne en 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; 
    } 

je reçois une valeur pour mon « hm.get (cond) » de ce « http://www.personal.psu.edu/tmv105/video/sunny/sunny.mp4 » je reçois pas de valeur pour « tempPath » qui est la valeur que je passe au-dessus à l'appel de cette méthode comme ceci: (MVID est mon VideoView)

mPath = LayoutConditions.getVideoPath(wd.getCurrentIconCode()); 
mVid.setVideoURI(mPath); 
mVid.requestFocus(); 
mVid.start(); 

Toute idée comment je pourrais gérer cela? Merci d'avance pour toute aide fournie!

Répondre

5

Essayez ceci:

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

Works fabuleusement! Merci! :) – taraloca

+0

Vous êtes les bienvenus :) – xil3

Questions connexes