@Nullable
    public static String getMimeFileExtension(@Nullable final Uri uri) {
        if (uri == null) {
            return null;
        }
        String extension = MimeTypeMap.getFileExtensionFromUrl(uri.toString());
        if (extension == null) {
            extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(getMimeType(uri));
        }
        return extension;
    }
Utility class prvoding helper methods when dealing with Uris
main/src/main/java/cgeo/geocaching/utils/UriUtils.java