0

我从服务器下载了一个文件并将其保存在 DOWNLOAD 文件夹中

我如何使用代码从 android 的默认播放器播放它?

与肌动蛋白代码?喜欢这段代码

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);
4

1 回答 1

2

您设置的“类型”错误。使用以下代码。

Intent i = new Intent(Intent.ACTION_VIEW);                      
i.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "tarsnak.3gp")),"video/*");
startActivity(i); 
于 2012-12-16T18:44:13.223 回答