Java Code Examples for android.webkit.MimeTypeMap#hasExtension()
The following examples show how to use
android.webkit.MimeTypeMap#hasExtension() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileUtils.java From a with GNU General Public License v3.0 | 5 votes |
/** * 获取文件的MIME类型 */ public static String getMimeType(String pathOrUrl) { String ext = getExtension(pathOrUrl); MimeTypeMap map = MimeTypeMap.getSingleton(); String mimeType; if (map.hasExtension(ext)) { mimeType = map.getMimeTypeFromExtension(ext); } else { mimeType = "*/*"; } return mimeType; }
Example 2
Source File: FileUtils.java From FilePicker with MIT License | 5 votes |
/** * 获取文件的MIME类型 */ public static String getMimeType(String pathOrUrl) { String ext = getExtension(pathOrUrl); MimeTypeMap map = MimeTypeMap.getSingleton(); String mimeType; if (map.hasExtension(ext)) { mimeType = map.getMimeTypeFromExtension(ext); } else { mimeType = "*/*"; } return mimeType; }
Example 3
Source File: FileUtils.java From MyBookshelf with GNU General Public License v3.0 | 5 votes |
/** * 获取文件的MIME类型 */ public static String getMimeType(String pathOrUrl) { String ext = getExtension(pathOrUrl); MimeTypeMap map = MimeTypeMap.getSingleton(); String mimeType; if (map.hasExtension(ext)) { mimeType = map.getMimeTypeFromExtension(ext); } else { mimeType = "*/*"; } return mimeType; }
Example 4
Source File: FileUtils.java From AndroidDownload with Apache License 2.0 | 5 votes |
/** * 获取文件的MIME类型 */ public static String getMimeType(String pathOrUrl) { String ext = getExtension(pathOrUrl); MimeTypeMap map = MimeTypeMap.getSingleton(); String mimeType; if (map.hasExtension(ext)) { mimeType = map.getMimeTypeFromExtension(ext); } else { mimeType = "*/*"; } return mimeType; }
Example 5
Source File: UiUtils.java From tindroid with Apache License 2.0 | 5 votes |
static String getMimeType(Uri uri) { if (uri == null) { return null; } MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton(); String ext = MimeTypeMap.getFileExtensionFromUrl(uri.toString()); if (mimeTypeMap.hasExtension(ext)) { return mimeTypeMap.getMimeTypeFromExtension(ext); } return null; }
Example 6
Source File: FileUtils.java From AndroidPicker with MIT License | 5 votes |
/** * 获取文件的MIME类型 */ public static String getMimeType(String pathOrUrl) { String ext = getExtension(pathOrUrl); MimeTypeMap map = MimeTypeMap.getSingleton(); String mimeType; if (map.hasExtension(ext)) { mimeType = map.getMimeTypeFromExtension(ext); } else { mimeType = "*/*"; } LogUtils.verbose(pathOrUrl + ": " + mimeType); return mimeType; }