how to check data is either video or image in android? -
i using intent picking image or video gallery in android app.
i using following code
string filetypestring = "image/* video/*"; intent selectfileintent = new intent(intent.action_pick, mediastore.images.media.external_content_uri); selectfileintent.settype(filetypestring); startactivityforresult(selectfileintent, uploadimageasynctask.media_picker);
now how can find result either image or video?
edit: uploadimageasynctask.media_picker request code have generated elsewhere.
call below method parameter of filepath.
public string getmimetype(string filepath) { string type = null; string extension = getfileextensionfromurl(filepath); if (extension != null) { mimetypemap mime = mimetypemap.getsingleton(); type = mime.getmimetypefromextension(extension); } return type; }
Comments
Post a Comment