2010-09-13 78 views

回答

2

一種方法是使用ACTION_VIEW意圖在Android視頻播放器中打開視頻。 (如果您還安裝了其他可以播放視頻的應用程序,則會提示用戶選擇一個,並且他們可以設置默認值以保存每次提示。)

例如,在您的ListActivity子類的onCreate方法中:

getListView().setOnItemClickListener(new OnItemClickListener() { 
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) { 
     try { 
      Intent in = new Intent(Intent.ACTION_VIEW); 
      in.setDataAndType(Uri.parse("http://example.org/video.mp4"), "video/*"); 
      startActivity(in); 
     } catch (Exception e) { 
      System.out.println(e.getMessage()); 
     } 
    } 
});