RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.81k stars 405 forks source link

Resulting bitmap is null on API 17 #366

Open arsenii-repository opened 5 years ago

arsenii-repository commented 5 years ago

What are you trying to achieve or the steps to reproduce?

I want to take a photo from camera and show it in ImageView.

How did you initialize FA?

        Fotoapparat
                .with(this)
                .into(cameraView)
                .previewScaleType(ScaleType.CenterCrop)
                .lensPosition(back())
                .logger(loggers(
                        logcat()
                ))
                .cameraErrorCallback(e -> {
                    Log.e(TAG, e.toString());
                })
                .build();

What was the result you received?

In whenDone callback bitmap is null.

PhotoResult photoResult = fotoapparat.takePicture();
photoResult
    .toBitmap(scaled(0.25f))
    .whenDone(bitmapPhoto -> {
        if (bitmapPhoto == null) {
            Log.e(TAG, "Couldn't capture photo. Bitmap is null.");
        }
    });

What did you expect?

Bitmap isn't null.

Context:

How can I solve this?

Thanks in advance.