Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No enclosing instance of type Camera is accessible

Tags:

android

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, it is a public constructor

Android Camera documentation

Anything I had missed out?

like image 435
Cheok Yan Cheng Avatar asked Mar 01 '12 01:03

Cheok Yan Cheng


1 Answers

Try this:

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

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

like image 74
sler Avatar answered Nov 09 '22 13:11

sler