i selected 10 images from gallery but how to show the selected images

ganeshvelsol | 12 xp

on button click i opened gallery and  selected 10 images , but i want to show selected images in separate layout .

Thanks in advance.

Sindhuja K | 196 xp
Best Answer ganeshvelsol selected as best answer
  1. Add a checkbox at the top of every image in gallery.



2. Select the images required and get the positions of checked items.
//Show hide select button if images are selected or deselected
    public void showSelectButton() {
        ArrayList<String> selectedItems = imagesAdapter.getCheckedItems();
        if (selectedItems.size() > 0) {
            selectImages.setText(selectedItems.size() + ” – Images Selected”);
        } else
3. Fill the checked items into an array list.

ArrayList<String> selectedItems = imagesAdapter.getCheckedItems();

4. Send the result to an activity with selected images.

Intent intent = new Intent();
intent.putExtra(MainActivity.CustomGalleryIntentKey, selectedItems.toString());//Convert Array into string to pass data
setResult(RESULT_OK, intent);