BSImagePicker icon indicating copy to clipboard operation
BSImagePicker copied to clipboard

Getting No Such File or Directory

Open Mfdsix opened this issue 5 years ago • 1 comments

when i try to make new File object from returned Uri, i got error No Such File or Directory. How can i fix this ?

Mfdsix avatar Sep 17 '20 01:09 Mfdsix

when i try to make new File object from returned Uri, i got error No Such File or Directory. How can i fix this ?

I use this function to convert uri to real path, while contentURI is the uri passed from bsimagepicker

private String getRealPathFromURI(Uri contentURI) { String result=contentURI.getPath(); Cursor cursor = getActivity().getContentResolver().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similar local file path result = contentURI.getPath(); } else { if (cursor.moveToFirst()) { result = cursor.getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA)); } cursor.close(); } return result; }

Toprakete avatar Sep 17 '20 13:09 Toprakete