Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting No Such File or Directory #51

Open
Mfdsix opened this issue Sep 17, 2020 · 1 comment
Open

Getting No Such File or Directory #51

Mfdsix opened this issue Sep 17, 2020 · 1 comment

Comments

@Mfdsix
Copy link

Mfdsix commented Sep 17, 2020

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

@Toprakete
Copy link

Toprakete commented Sep 17, 2020

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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants