Skip to content

Android 11 : pdf document throw com.android.providers.media.documents throw NullpointerException #7

Description

@alexist

When i select a pdf document, the content uri is

content://com.android.providers.media.documents/document/document%3A30

Logcat logs :

D/[FilePath plugin]:: File - Authority: com.android.providers.media.documents, Fragment: null, Port: -1, Query: null, Scheme: content, Host: com.android.providers.media.documents, Segments: [document, document:30]

FilePath.getPath is looking for a media document

       // MediaProvider
        else if (isMediaDocument(uri)) {

The docId is document:30, type is "document"

But doesn't handle "document"

           Uri contentUri = null;
            if ("image".equals(type)) {
                contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
            } else if ("video".equals(type)) {
                contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
            } else if ("audio".equals(type)) {
                contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
            }

=> contenUri is Null

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions