Skip to content Skip to sidebar Skip to footer

Cant Create Camera Preview In Oncreate?

I'm having some issues with the preview of the camera on my Android. Right now i have a button you need to press before you get any preview of the camera. but id like to have a pre

Solution 1:

In addition to adding the setPreviewDisplay to the onCreate try doing ->

Implement the SurfaceHolder.Callback

In onSurfaceChanged method reset the setPreviewDisplay with the new surfaceHolder that is passed to that method.

This works for me..

Solution 2:

Have you checked the permissions in the manifest? Also try not to do that much in the OnCreate, it's a bad practice and please, for the love of god, comment the code if you want help.

Ok, try changing the orientation of the layout and tell me what happens.

Post a Comment for "Cant Create Camera Preview In Oncreate?"