Reputation: 4606
Is there any elegant way (not just if ("fileExt".compareTo(".mp3")) {MIME_TYPE = "audio/*"}
) to learn programatically the MIME type that should be put into an intent, with which I have to open the file?
Thanks!
Upvotes: 8
Views: 8606
Reputation: 8991
well it does the same as your if statement but is slightly more elegant
Use the MimeTypeMap class
http://developer.android.com/reference/android/webkit/MimeTypeMap.html
Upvotes: 12
Reputation: 700
You can use MediaStore to find the mime type:
http://developer.android.com/reference/android/provider/MediaStore.MediaColumns.html#MIME_TYPE
Upvotes: 0