Skip to content

Instantly share code, notes, and snippets.

@MichaelPolla
Last active July 19, 2016 12:30
Show Gist options
  • Save MichaelPolla/deb2ec0b453a83f0b02a22a44c1ec865 to your computer and use it in GitHub Desktop.
Save MichaelPolla/deb2ec0b453a83f0b02a22a44c1ec865 to your computer and use it in GitHub Desktop.
[Android] Open the document app on the phone to pick a picture (or any kind of files)
private static final int PICK_IMAGE = 1; // number that identify the request (can be any number)
//...
// Called e.g. when clicking on a button
public void addPicture() {
Intent intent = new Intent();
intent.setType("image/*"); // the type of data we are interested of
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select picture"), PICK_IMAGE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment