Android: Get file mime type from filename

Man, I wish it were this easy in all languages and platforms!

import android.webkit.MimeTypeMap;


Where source would be either a filename or URL.

*same day edit*

Wow, that's a first I've had to update a post a few hours after putting it up.

There was a bug with filenames containing spaces, causing getFileExtensionsFromUrl() to return null.


Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog