AndroidScannerDemo icon indicating copy to clipboard operation
AndroidScannerDemo copied to clipboard

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

Open silkograph opened this issue 4 years ago • 0 comments

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.

silkograph avatar Dec 16 '21 18:12 silkograph