public static String UriToPath(Uri uri) {
        String path = null;
        ContentResolver cr = context.getContentResolver();
        Cursor cursor = cr.query(uri, null, null, null, null);
        cursor.moveToFirst();
        if (cursor != null) {
            path = cursor.getString(1);
            cursor.close();
        }
        return path;
    }