For example:
int width = 720;
int height = 1280;
I want to create a Camera.Size.
Camera.Size size = new Camera.Size(width,height);
But it has some error.
No enclosing instance of type Camera is accessible. Must qualify the allocation with an enclosing instance of type Camera (e.g. x.new A() where x is an instance of Camera).
Actually, a slightly different syntax is required:
Camera camera = Camera.open();
Camera.Size size = camera.new Size(width, height);
I know you have posted your question a long time ago but I have some explanation about this error. As you can see here the class Size is declared as public (but non static) into the class Camera. You can find some information about this architecture here.
So to create a new Camera.Size object, you have to start by creating a Camera object.
Camera camera = Camera.open();
Then you can create your Camera.Size object:
Camera.Size size = camera.new Camera.Size(width, height);
I'm not sure you really want to use this way to do this, but this is the explanation about your error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With