Skip to content

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

@hidekisdev

Description

@hidekisdev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions