CameraKit / camerakit-android

Library for Android Camera 1 and 2 APIs. Massively increase stability and reliability of photo and video capture on all Android devices.
https://camerakit.io
MIT License
5.36k stars 878 forks source link

Can't seem to take images when using Kotlin #556

Open YaddyVirus opened 5 years ago

YaddyVirus commented 5 years ago

I've been struggling to get CameraKit running on Kotlin. So far, I've only been able to get a video stream from my camera.

I want to capture an image but I run into an error on this line

cameraKitView.captureImage(object:CameraKitView.ImageCallback() {
  override fun onImage(cameraKitView:CameraKitView, capturedImage:ByteArray) {
  }
})

I get an error saying

This class does not have a constructor on the CameraKitView.ImageCallback() line.

I'm really clueless about how to resolve this. Any ideas?

Greeeeyyyss commented 5 years ago

We do it using lambda like this cameraKitView.captureImage { cameraKitView, byteArray -> // insert your code here }