Spin up the file chooser UI and select an image.

source: Android SDK Sample code
/**
* Fires an intent to spin up the “file chooser” UI and select an image.
*/
public void performFileSearch() {

// BEGIN_INCLUDE (use_open_document_intent)
// ACTION_OPEN_DOCUMENT is the intent to choose a file via the system’s file browser.
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);

// Filter to only show results that can be “opened”, such as a file (as opposed to a list
// of contacts or timezones)
intent.addCategory(Intent.CATEGORY_OPENABLE);

// Filter to show only images, using the image MIME data type.
// If one wanted to search for ogg vorbis files, the type would be “audio/ogg”.
// To search for all documents available via installed storage providers, it would be
// “*/*”.
intent.setType(“image/*”);

startActivityForResult(intent, READ_REQUEST_CODE);
// END_INCLUDE (use_open_document_intent)
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s