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

Select image in Android 8.x does not work correctly #139

Open
realsmartnose opened this issue Sep 7, 2018 · 0 comments
Open

Select image in Android 8.x does not work correctly #139

realsmartnose opened this issue Sep 7, 2018 · 0 comments

Comments

@realsmartnose
Copy link

In Android 8+ google change the content provider (it is no Long anymore, it is a string with "raw:"-prefix), your library is throwing an NumberFormatException...

The selected Uri looks like this:
content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2FCloudstationPrivate%2FTransfer%2Fimg.jpg

I fixed this by adding this to Util.getFileFromUri():

final String docId = DocumentsContract.getDocumentId(uri);
// Fix for OREO:
if (docId.startsWith("raw:")) {
  filePath = docId.replaceFirst("raw:", "");
} else if (isExternalStorageDocument(uri)) {...
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

1 participant