Search code examples
javaandroidphotomediastore

How to open full-featured android photo picker like google maps uses?


I'd like to use a photo picker like the one that google maps has, specifically one that combines recent photos, photo folders, and the option to capture a new photo from the camera. See example below.

desired photo picker

I don't need the multi-select or preview of selected photos option, just the part that starts with "yesterday".

My best guess is this code:

Intent intent = new Intent(Intent.ACTION_GET_CONTENT, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
startActivityForResult(intent, 0);

but that opens a far less fancy picker that just shows the recent photos, without the "camera" button or the "folders" shortcut.

so is this interface built into android or do I have to roll my own?


Solution

  • If you do not see a activity-start operation logged in Logcat, then you are seeing something internal to the Maps app: a fragment, a composable, or something along those lines.

    So, if you want that UI, you either need to write it yourself or see if there is a third-party library that offers something similar.