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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.