Skip to content

Hw to use library for multiple files selected from media library? #156

Description

@silkograph

I need to select multiple files from library and loop through each file and process it.
So far I enabled multiple file select option as follows
In openMediaContent method
startActivityForResult(intent, ScanConstants.PICKFILE_REQUEST_CODE);

and then in onActivityResult based on selection I added following for loop

else {
            ClipData clipData = data.getClipData();
            if (clipData != null) {
            for (int i =0; i< clipData.getItemCount(); i++) {
                Uri imageUrl = clipData.getItemAt(i).getUri();
                try {
                    InputStream is = getActivity().getContentResolver().openInputStream(imageUrl);
                    bitmap = BitmapFactory.decodeStream(is);
                    postImagePick(bitmap);
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
               }
            }
          ....

I am not getting error but it process only one file instead of all files.

How should I process all files if I select multiple files using this library.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions