Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This answer is based on your somewhat vague description. I assume that you fired an intent with action: <code>Intent.ACTION_GET_CONTENT</code></p> <p>And now you get <code>content://com.android.providers.media.documents/document/image:62</code> back instead of the previously media provider URI, correct?</p> <p>On Android 4.4 (KitKat) the new DocumentsActivity gets opened when an <code>Intent.ACTION_GET_CONTENT</code> is fired thus leading to grid view (or list view) where you can pick an image, this will return the following URIs to calling context (example): <code>content://com.android.providers.media.documents/document/image:62</code> (these are the URIs to the new document provider, it abstracts away the underlying data by providing generic document provider URIs to clients).</p> <p><strong>You can however access both gallery and other activities responding to <code>Intent.ACTION_GET_CONTENT</code> by using the drawer in the DocumentsActivity (drag from left to right and you'll see a drawer UI with Gallery to choose from). Just as pre KitKat.</strong></p> <p>If you still which to pick in DocumentsActivity class and need the file URI, you should be able to do the following (warning this is hacky!) query (with contentresolver):<code>content://com.android.providers.media.documents/document/image:62</code> URI and read the _display_name value from the cursor. This is somewhat unique name (just the filename on local files) and use that in a selection (when querying) to mediaprovider to get the correct row corresponding to this selection from here you can fetch the file URI as well.</p> <p>The recommended ways of accessing document provider can be found here (get an inputstream or file descriptor to read file/bitmap):</p> <p><a href="https://developer.android.com/guide/topics/providers/document-provider.html" rel="nofollow noreferrer">Examples of using documentprovider</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload