Java tutorial
//package com.java2s; import android.webkit.MimeTypeMap; public class Main { /** * Tries to retrieve mime types from file extension * @param url * @return */ public static String getMimeType(String url) { String type = null; String extension = MimeTypeMap.getFileExtensionFromUrl(url); if (extension != null) { MimeTypeMap mime = MimeTypeMap.getSingleton(); type = mime.getMimeTypeFromExtension(extension); } return type; } }