Saturday, April 2, 2016

Open images with Intent.ACTION_OPEN_DOCUMENT, Intent.ACTION_GET_CONTENT and Intent.ACTION_PICK

Example show how to select images by calling startActivityForResult() with Intent.ACTION_OPEN_DOCUMENT (Android 4.4, API level 19, and higher), Intent.ACTION_GET_CONTENT and Intent.ACTION_PICK, then load it using InputStream.

Tested on Nexus 7 running Android 5.1.1, to load photos from local and from cloud of Google Photos.

In my test:
- if select photos with Intent.ACTION_OPEN_DOCUMENT or Intent.ACTION_GET_CONTENT, both photos on local storage and on Google Photos cloud storage can be loaded using InputStream.
- if select photos with Intent.ACTION_PICK, cannot load from Google Photos cloud storage. (or may be by other method, I don't know).