0

I'm using following code :

 public String getRealPathFromURI(Context context, Uri contentUri) {
    Cursor cursor = null;
    try {
        cursor = context.getContentResolver().query(contentUri, null, null, null, null);
        int column_index = cursor.getColumnIndexOrThrow("_data");
        cursor.moveToFirst();
        return cursor.getString(column_index);
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }
}

I'm choosing the file from internal storage than path :

/storage/emulated/0/xyz.pdf //It's ok

but when I'm choosing from external storage than:

/mnt/media_rw/A67C-EC20/xyz.pdf // File not found Exception (permission denied)

Sorry for English.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

0 Answers0