开发者

Show mp4 and 3gp files for selection in Android

开发者 https://www.devze.com 2023-03-30 05:47 出处:网络
I have an app where i need to select vi开发者_StackOverflow社区deo files of .3gp and .mp4 format only. I use the following code. It shows only 3gp files , how do i show mp4 files also?

I have an app where i need to select vi开发者_StackOverflow社区deo files of .3gp and .mp4 format only. I use the following code. It shows only 3gp files , how do i show mp4 files also?

intent.setType("video/*");
intent.putExtra("only3gp", true);

Please help.


Why don't you go about finding the extensions of file manually like this,

Intent intent= new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        Uri filetype= Uri.parse("file://" + file.getPath());
        String filename=file.getName();
if(filename.endsWith(".mp4")||filename.endsWith(".3gp"))
 {
            intent.setDataAndType(filetype, "video/*");
            startActivity(intent);
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消