Sunday, September 25, 2011

Get mime type of a file


In android to get mime type is very easy...

To find the mime type of a file, path

String extention =  path.substring(path.lastIndexOf(.) );
String mimeTypeMap =MimeTypeMap.getFileExtensionFromUrl(extention);
String mimeType = MimeTypeMap.getSingleton()
                        .getMimeTypeFromExtension(mimeTypeMap);

2 comments: