Android image picker for local files only

JamieH picture JamieH · Jan 31, 2012 · Viewed 11.4k times · Source

I'm using the built in Android image picker as follows:

Intent photoPickerIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
m_activity.startActivityForResult(photoPickerIntent, PHOTO_PICKER_ID);

Is there any way to restrict this to show only locally available files. On my device it is currently picking up Picasa thumbnails and I'd like to exclude all images that are not actually present on the device.

Answer

DevDreed picture DevDreed · Feb 3, 2013

Adding intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); will allow for local files only. It will exclude picasa images. Hope this helps.

    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
    startActivityForResult(Intent.createChooser(intent,
            "Complete action using"), PHOTO_PICKER_ID);