Фото не сохраняется в памяти

Пытаюсь сохранить фото в папку data но ничего не получается, всё запускается и работает но фотографий сохранённых найти не могу из этого делаю вывод что у меня проблемы в коде помогите

private boolean Save(Bitmap img) {

        String imageName = "SSSS";

        Bitmap sourceBitmap = img;

        boolean imageSaved = false;

        if (sourceBitmap != null && !sourceBitmap.isRecycled()) {
            File storagePath = new File(String.valueOf(this.cont.getDataDir()));
            Log.i("Save", String.valueOf(storagePath));

            if (!storagePath.exists()) {
                storagePath.mkdirs();
            }

            int count = Objects.requireNonNull(storagePath.list()).length;

            Log.i("Save", "Succes");

            imageName = String.valueOf(count + 1) + "_area";

            FileOutputStream out = null;
            File imageFile = new File(storagePath, String.format("%s.png",
                    imageName));
            try {
                out = new FileOutputStream(imageFile);
                imageSaved = sourceBitmap.compress(Bitmap.CompressFormat.PNG,
                        100, out);
                out.flush();
                out.close();
                Log.i("Save", "imageSaved completed");
            } catch (Exception e) {
                Log.e("Save", "Unable to write the image to gallery" + e);
            }

            ContentValues values = new ContentValues(3);
            values.put(MediaStore.Images.Media.TITLE, imageName);
            values.put(MediaStore.Images.Media.MIME_TYPE, "image/png");
            values.put("_data", imageFile.getAbsolutePath());

            Uri res = this.cont.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
            Log.i("Save", String.valueOf(res));
        }

        return imageSaved;
    }

logs:

I/Save: /data/user/0/com.avmdev.MyGarden
I/Save: imageSaved completed
I/Save: content://media/external/images/media/35789

Ответы (0 шт):