I am using following code to select a image or video from gallery :
imgGallery.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent pickPhoto = new Intent(Intent.ACTION_GET_CONTENT);
pickPhoto.setType("*/*");
String[] mimetypes = {"image/*", "video/*"};
pickPhoto.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
startActivityForResult(pickPhoto,
SELECT_PICTURE_OR_VIDEO);
}
});
Please note I am using same button for image or video selection. So when onActivityResult will be called, is there any way from which I can know that a image was selected or video was selected from the gallery?