Disable camera in camera control

121 views
Skip to first unread message

Ananda Chakraborti

unread,
Jun 23, 2021, 11:07:12 AM6/23/21
to Android CameraX Discussion Group
Hello,

I am trying to write a method to disable the camera.  I create a method like 

private fun stopPreviewAndFreeCamera() {
camera.apply {
stopPreview()
release()
camera = null
}
}


and call stopPreviewAndFreeCamera() in the disable method. I get Unresolved reference: stopPreview. I do not understand why. Can someone help?

-An

Scott Nien

unread,
Jun 24, 2021, 5:34:29 AM6/24/21
to Ananda Chakraborti, Android CameraX Discussion Group
I guess you are copying some codes from here using camera1 API ? 

stopReview is a public method in android.hardware.Camera.   
You can check the doc carefully if anything is missing.  



--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/4f9c2f37-fa31-4cbd-a5e8-9ee633f91292n%40android.com.

Ananda Chakraborti

unread,
Jul 6, 2021, 10:13:14 AM7/6/21
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group, Ananda Chakraborti
Hi,
What do you mean by anything missing?

Ananda Chakraborti

unread,
Jul 6, 2021, 10:20:53 AM7/6/21
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group, Ananda Chakraborti
I explained the problem better here
On Thursday, June 24, 2021 at 12:34:29 PM UTC+3 Scott Nien wrote:
Reply all
Reply to author
Forward
0 new messages