Java tutorial
//package com.java2s; /* CanvasDrawUtils.java Copyright (c) 2015 NTT DOCOMO,INC. Released under the MIT license http://opensource.org/licenses/mit-license.php */ import android.webkit.MimeTypeMap; public class Main { /** * Get MimeType. * * @param url file's url * @return file's MimeType */ public static String getMimeType(final String url) { String type = null; String extension = MimeTypeMap.getFileExtensionFromUrl(url); if (extension != null) { type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); } return type; } }