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);
}
精彩评论