No instances of type Camera are available.

I have the following code

android.hardware.Camera.Size size = new android.hardware.Camera.Size(300, 300); 

I get the following compilation error

 No enclosing instance of type Camera is accessible 

However, I check the documentation, this is an open constructor

Android Camera Documentation

Anything I missed?

+6
source share
1 answer

Try the following:

 Camera cam = Camera.open(); Size size = cam.new Size(100, 100); 

Not quite sure why this is needed, but it seems to work for me.

+11
source

Source: https://habr.com/ru/post/909700/


All Articles