Android examples for android.media:Video
is Video file name
import android.provider.MediaStore; import android.provider.MediaStore; import android.util.Log; public class Main{ /**//from w ww . ja v a 2s . c o m * Whether the filename is a video file. * * @param filename * @return */ public static boolean isVideo(String filename) { String mimeType = getMimeType(filename); if (mimeType != null && mimeType.startsWith("video/")) { return true; } else { return false; } } /** * Returns the MIME type for a given file name, based on its extension. * * @param filename * @return MIME type; "" if unknown; null if filename is null. */ public static String getMimeType(String filename) { String mimeType = null; if (filename == null) { return mimeType; } if (filename.endsWith(".3gp")) { mimeType = "video/3gpp"; } else if (filename.endsWith(".mid")) { mimeType = "audio/mid"; } else if (filename.endsWith(".mp3")) { mimeType = "audio/mpeg"; } else if (filename.endsWith(".xml")) { mimeType = "text/xml"; } else { Log.i("TAG", "Unknown media type of file '" + filename + "'"); mimeType = ""; } return mimeType; } }