如何在SD卡中播放从服务器下载的视频



>我有一个从服务器下载的文件并将其保存在下载文件夹中

如何从带有代码的安卓默认播放器播放它?

用肌动蛋白代码? 像这个代码

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

您设置了错误的"类型"。使用以下代码。

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

最新更新