开发者

Show mp4 and 3gp files for selection in Android

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜