Java tutorial
//package com.java2s; import android.net.Uri; import android.webkit.MimeTypeMap; import java.io.File; public class Main { public static boolean isPicture(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("image/")); } }