Exercising the Getcontent Action

ACTION_GET_CONTENT is similar to ACTION_PICK. In the case of ACTION_PICK, you are specifying a URI that points to a collection of items such as a collection of notes. You will expect the action to pick one of the notes and return it to the caller. In the case of ACTION_GET_CONTENT, you indicate to Android that you need an item of a particular MIME type. Android searches for either activities that can create one of those items or activities that can choose from an existing set of items that satisfy that MIME type.

Using ACTION_GET_CONTENT, you can pick a note from a collection of notes supported by the Notepad application using the following code:

public static void invokeGetContent(Activity activity) {

Intent pickIntent = new Intent(Intent.ACTION_GET_CONTENT); int requestCode = 2;

0 0

Post a comment