onclick(View view) {
GetFileExtension(videouri);
Toast.makeText(this, "Exten: "+GetFileExtension(videouri), Toast.LENGTH_SHORT).show();
}
// Get Extension
public String GetFileExtension(Uri uri){
ContentResolver contentResolver = getContentResolver();
MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
// Return file extension
return mimeTypeMap.getExtensionFromMimeType(contentResolver.getType(uri));
}
Here the videouri variable has a video. I mean:
videouri = data.getData();
under onResultActivity.
You can pass any variable here such as an image, video, MP3, and file/documents. It will work for all type of contents.
It's a corporate code mostly used for commercial purposes.
I'm 100 % sure it will work with confidence...