Java tutorial
//package com.java2s; import android.net.Uri; import android.webkit.MimeTypeMap; import java.io.File; public class Main { static boolean isVideo(File file) { Uri uri = Uri.fromFile(file); String type = MimeTypeMap.getSingleton() .getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(uri.toString())); if (type == null) return false; else return (type.toLowerCase().startsWith("video/")); } }