Selecting Images Using the Built-In Gallery Application

As we know, using an intent is often the quickest way to harness a capability that already exists in a pre-installed Android application. For the purposes of the examples in this chapter, let's look at how we can harness the built-in Gallery application to select an image that we might want to work with.

The intent that we'll want to use is a generic Intent.ACTION_PICK that signals to Android that we want to select a piece of data. We also supply a URI for the data that we want to pick from. In this case, we are using android.provier.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, which means that we'll be selecting images that are stored using the MediaStore on the SD card.

Intent choosePictureIntent ...

Get Pro Android Media: Developing Graphics, Music, Video, and Rich Media Apps for Smartphones and Tablets now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.