MLKitAndroid icon indicating copy to clipboard operation
MLKitAndroid copied to clipboard

camerakit

Open jinman opened this issue 6 years ago • 4 comments

I upgraded it from wonderklin package to new camerakit version and using AndroidX. but this code in BarCodeReaderActivity

    override fun onClick(v: View) {
        fabProgressCircle.show()
        cameraKitView.captureImage { cameraKitImage ->
            // Get the Bitmap from the captured shot
            getQRCodeDetails(cameraKitImage.bitmap)
            runOnUiThread {
                showPreview()
                imagePreview.setImageBitmap(cameraKitImage.bitmap)
            }
        }
    }

Is not compiling. Not sure what is wrong? Any suggestions

jinman avatar Feb 20 '19 08:02 jinman

Hi, what's the issue that you're facing @jinman?

harshithdwivedi avatar Mar 06 '19 21:03 harshithdwivedi

CameraKit 1.0 breaks API compatibility with CameraKit 0.13

The example code uses com.wonderkiln.camerakit.CameraView from CameraKit 0.13 which has a captureImage that works like that, but in CameraKit 1.0 with com.camerakit.CameraKitView captureImage and friends only accept callbacks with this signature: (com.camerakit.CameraKitView cameraKitView, byte[] bytes).

I tried to figure out how to get a bitmap out of those bytes right now as there's no object that has a bitmap property, but I gave up and moved back to 0.13, for which at least the docs and examples match.

Uplink03 avatar Apr 24 '19 23:04 Uplink03

Good news: I figured out how to get a bitmap out of the byte array and fix your function:

    override fun onClick(v: View) {
        fabProgressCircle.show()
        cameraKitView.captureImage { cameraKitView, jpeg ->
            val bitmap = BitmapFactory.decodeByteArray(jpeg, 0, jpeg.size)
            // Get the Bitmap from the captured shot
            getQRCodeDetails(bitmap)
            runOnUiThread {
                showPreview()
                imagePreview.setImageBitmap(bitmap)
            }
        }
    }

Bad news: It doesn't capture anything... as described in this CameraKit's issue: https://github.com/CameraKit/camerakit-android/issues/533

Uplink03 avatar Apr 27 '19 03:04 Uplink03

Check this out. Degrade the version. https://github.com/CameraKit/camerakit-android/issues/533#issuecomment-524150954

pravingaikwad07 avatar Jul 18 '20 21:07 pravingaikwad07