ContentResolver
Also known as: android contentresolver, content resolver android, query media, Context.getContentResolver
ContentResolver is the Android client object that talks to content providers. Apps use it to query, insert, update, and delete data behind content:// URIs, including the MediaStore, which is how they list and read photos and videos under scoped storage.
- Obtained via Context.getContentResolver(); the client for all content providers.
- query() returns a Cursor; it also opens streams and loads thumbnails for media.
- Deleting media the app does not own triggers a system confirmation dialog.
What ContentResolver does
Obtained via Context.getContentResolver(), a ContentResolver is the front door to every ContentProvider on the device. It resolves a content:// URI to the right provider and forwards the operation: query() to read rows as a Cursor, plus insert(), update(), delete(), and applyBatch() for writes.
For media it also offers helpers like openFileDescriptor() and openInputStream() to read bytes, and loadThumbnail() (Android 10+) to fetch a sized thumbnail directly. Modern queries pass a Bundle of arguments for selection, sort order, and paging via ContentResolver.QUERY_ARG_* keys.
Querying MediaStore with ContentResolver
A typical scan calls contentResolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, ...) with a projection of columns such as _ID, SIZE, DATE_TAKEN, and DISPLAY_NAME, then iterates the returned Cursor. Each row's ID is combined into a per-item content URI for loading the image or thumbnail.
Under scoped storage this is the supported way to read shared media: you do not hold a raw file path, you hold a content URI mediated by the resolver. Deleting media routed through ContentResolver that the app does not own triggers the system's user-confirmation flow (MediaStore.createDeleteRequest() on Android 11+).
Why it matters for a cleaner
A duplicate-photo cleaner like Cleanor uses ContentResolver as the engine of its scan: one query enumerates the library's images with their sizes and dates, the resolver streams thumbnails for fast comparison, and grouped duplicates are removed through the resolver's delete request so the user confirms each batch.
Because everything goes through content URIs and standard permissions, the app reads only what the user granted and never bypasses the platform's media-access rules.