Android - choose photos from library

444 views Asked by At

I'm needing the simple ability to choose photos (with the option to choose up to 10) from the native album(s).

I found this great library:

https://github.com/esafirm/android-image-picker

I have implemented it, it's great and allows me to choose photos. But when it falls into the onActivityResult() method, I have absolutely no clue how to extract the images selected.

It gives a line of code:

    ArrayList<Image> images = data.getParcelableArrayListExtra(ImagePickerActivity.INTENT_EXTRA_SELECTED_IMAGES);

when there is no indication of how to pass in the "INTENT_EXTRA_SELECTED_IMAGES", even when I try to pass that in, every way possible. This constant field seems to be related to something different..

I basically just need a library like this, to select photos from the local gallery, and I need to have a list of them so that I can process them accordingly. Is there a more simple way of doing this, or am I missing something simple on how to get these images from after they have selected them?

1

There are 1 answers

0
PEHLAJ On BEST ANSWER

Alternatively, you can get images using ImagePicker.getImages method in onActivityResult

@Override
if (requestCode == REQUEST_CODE_PICKER && resultCode == RESULT_OK && data != null) {
    ArrayList<Image> images = (ArrayList<Image>) ImagePicker.getImages(data);
}