Skip to content

Image saving error #990

@Stepanoff94

Description

@Stepanoff94

The method cropAndSaveImage() failed with an error.
java.lang.NullPointerException: ViewBitmap is null

binding.imageView.cropImageView.isRotateEnabled = false
binding.imageView.cropImageView.targetAspectRatio = 1.0f
binding.imageView.overlayView.setCircleDimmedLayer(true)
binding.imageView.cropImageView.setImageURI(uri)

binding.imageView.cropImageView.cropAndSaveImage(
                Bitmap.CompressFormat.PNG,
                100,
                object : BitmapCropCallback {
                    override fun onBitmapCropped(
                        resultUri: Uri,
                        offsetX: Int,
                        offsetY: Int,
                        imageWidth: Int,
                        imageHeight: Int,
                    ) {
                        setFragmentResult(
                            Constants.RequestCode.CROP_IMAGE,
                            bundleOf(Constants.ResultCode.RESULT to resultUri)
                        )
                        onBackPressed()
                    }

                    override fun onCropFailure(t: Throwable) {
                        handleError(t)
                    }
                }
            )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions