@Nullable
    public static String getMimeType(@Nullable final Uri uri) {
        if (uri == null) {
            return null;
        }
        String mimeType = null;
        final Context context = CgeoApplication.getInstance();
        if (context != null && context.getContentResolver() != null) {
            mimeType = context.getContentResolver().getType(uri);
        }
        if (StringUtils.isBlank(mimeType)) {
            mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(uri.toString()));
        }
        if (StringUtils.isBlank(mimeType)) {
            final String uriString = uri.toString();
            final int lidx = uriString.lastIndexOf(".");
            if (lidx >= 0) {
                mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(uriString.substring(lidx + 1));
            }
        }
        return StringUtils.isBlank(mimeType) ? null : mimeType;
    }
Utility class prvoding helper methods when dealing with Uris
main/src/main/java/cgeo/geocaching/utils/UriUtils.java