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:

  1. Nice. It is useful. I have written a blog and want peope read it to increase their knowledge. Read about What Are MIME Types

    ReplyDelete