List of usage examples for android.webkit MimeTypeMap getSingleton
public static MimeTypeMap getSingleton()
From source file:com.android.mms.ui.MessageUtils.java
public static String getContentType(Uri uri) { String path = uri.getPath();/*from w ww .j a v a 2 s . c om*/ MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton(); String extension = MimeTypeMap.getFileExtensionFromUrl(path).toLowerCase(); if (TextUtils.isEmpty(extension)) { int dotPos = path.lastIndexOf('.'); if (0 <= dotPos) { extension = path.substring(dotPos + 1); extension = extension.toLowerCase(); } } String type = mimeTypeMap.getMimeTypeFromExtension(extension); return type; }