1

I am getting customers documents using FilePicker . After opening FilePicker it shows options to take images from gallery as well as camera .

After taking images , images are visible inside gallery but But i don't want images to be visible inside gallery . and i know there are already questions about hiding images from gallery but not from FilePicker .

What should i do ? I think saving images inside a folder Android/App/data inside internal/external storage will do it . But how to get the folder location and save images there . ? or any other solution that can help?

here is code inside onClick() method .

if (view == pickPhotoBtn) {
        FilePickerBuilder.getInstance().setMaxCount(10)
                .setActivityTheme(R.style.AppTheme3)
                .pickPhoto(getActivity());
  }

and this is onActivityResult() method .

 @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {

        case FilePickerConst.REQUEST_CODE_PHOTO:

            if (resultCode == Activity.RESULT_OK && data != null) {
                Log.e(TAG, "onActivityResult: ");
                for (String path : data.getStringArrayListExtra(FilePickerConst.KEY_SELECTED_PHOTOS)) {
                    String fileName = CommonMethod.getFileNameFromPath(path);

                    if (!documentNameList.contains(fileName) && !selectPhotosPath.contains(path) && selectPhotosPath.size() < 10) {
                        selectPhotosPath.add(path);
                        File file = new File(path);
                        Log.e(TAG, "Image Name: " + fileName);
                        documentNameList.add(fileName);
                        documentIdList.add(0);
                        selectPhotosBitmap.add(CommonMethod.compressImage(file, getContext()));
                    }
                }

                adapter.addItems(selectPhotosBitmap);
                adapter.notifyDataSetChanged();
                Log.e(TAG, "Number Of Files: " + selectPhotosPath.size());
            }

    }
}
Rashid Kalhoro
  • 340
  • 4
  • 14
  • What types of files do you take from file picker eg, images, pdf or take an image from the camera and is there really need to save those images? – nimi0112 Jan 29 '19 at 05:34
  • @nimi0112 yes images like customers photo or CNIC etc . i just want to hide those images from gallery . – Rashid Kalhoro Jan 29 '19 at 05:37
  • is there any need to save them? If you have received the image and you have sent those images to your backend why is there a need to save those images? – nimi0112 Jan 29 '19 at 05:40
  • @nimi0112 No need . but i am saving all customers data inside SQLite along with those images and after inserting images are visible inside gallery which i don't want to . what should i do ? – Rashid Kalhoro Jan 29 '19 at 05:43
  • have a look at this https://stackoverflow.com/a/35827955/6549598 – nimi0112 Jan 29 '19 at 05:48
  • @nimi0112 okay , will try – Rashid Kalhoro Jan 29 '19 at 06:03

1 Answers1

0

You can save your image in app internal storage and by default no one can access you app internal storage as it is private for other. You can check below link how to storage and retrive image from internal storage

Saving and Reading Bitmaps/Images from Internal memory in Android

Kajol Chaudhary
  • 257
  • 2
  • 9