I have a video file in SD card. I want to check whether that file is supported or not if not supported then i have to do some specific action. I have read the following document on supporting media file format in android. But Programmatic How to know whether the file is supported by my android device.
http://developer.android.com/guide/appendix/media-forma开发者_运维技巧ts.html
Thanks
Revisiting this question after I found it a few weeks ago unanswered....
You can try to play it in a VideoView...
videoView.setOnErrorListener(new OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
// An error occured trying to play the file, do something else.
}
});
This is not a way to "just check a file if it is supported" but you can use this to play the file and do something else if it is not supported.
I know it's a bit late answer but maybe someone will find in useful in future. You can check supported mime type in following way:
MimeTypeMap.getSingleton().hasMimeType(mimeType)
精彩评论