jhansireddy / AndroidScannerDemo

ScanLibrary is an android document scanning library built on top of OpenCV, using the app you will be able to select the exact edges and crop the document accordingly from the selected 4 edges and change the perspective transformation of the cropped image.
MIT License
1.07k stars 472 forks source link

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

Open silkograph opened 2 years ago

silkograph commented 2 years ago

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.