2012-12-16 59 views
0

下載我從服務器下載文件並將其保存在DOWNLOAD文件夾中如何播放視頻從服務器SD卡

我怎樣才能從代碼的Android的默認播放器中播放呢?

with actin code?像這樣的代碼

Intent intent = new Intent(Intent.ACTION_VIEW); 
      intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "tarsnak.3gp")), "application/vnd.android.package-archive"); 
      startActivity(intent); 

回答

2

您正在設置'type'錯誤。 使用以下代碼。

Intent i = new Intent(Intent.ACTION_VIEW);      
i.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "tarsnak.3gp")),"video/*"); 
startActivity(i);