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

Loading images from Downloads folder causes IllegalArgumentException on Android 9 and above and is not working #151

Open
hidekisdev opened this issue Oct 27, 2020 · 0 comments

Comments

@hidekisdev
Copy link

hidekisdev commented Oct 27, 2020

Android 9 and above, loading images in Downloads folder causes IllegalArgumentException and fails.
In Utils.java, getDataColumn method below fails.

      // DownloadsProvider
      else if (isDownloadsDocument(uri)) {
        final String id = DocumentsContract.getDocumentId(uri);
        // String "id" may not represent a valid Long type data, it may equals to
        // something like "raw:/storage/emulated/0/Download/some_file" instead.
        // Doing a check before passing the "id" to Long.valueOf(String) would be much safer.
        if (RawDocumentsHelper.isRawDocId(id)) {
          filePath = RawDocumentsHelper.getAbsoluteFilePath(id);
        } else {
          final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
          filePath = getDataColumn(context, contentUri, null, null);
        }
      }

I received the following message:
java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/5

Any solution / guidance would be appreciated.

@hidekisdev hidekisdev changed the title Loading images in Downloads folder causes NumberFormatException since Android 9 Loading images in Downloads folder causes NumberFormatException on Android 9 and above Mar 10, 2021
@hidekisdev hidekisdev changed the title Loading images in Downloads folder causes NumberFormatException on Android 9 and above Loading images from Downloads folder causes NumberFormatException on Android 9 and above and is not working Mar 10, 2021
@hidekisdev hidekisdev changed the title Loading images from Downloads folder causes NumberFormatException on Android 9 and above and is not working Loading images from Downloads folder causes IllegalArgumentException on Android 9 and above and is not working Mar 10, 2021
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