Hi everyone I am developing an application where I need to use the Camera and I'm having this problem on my code:
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) on line "this.preSize_ = new Camera(0,0); Any help? or suggestion?
private void setupCamera()
{
this.camera_ = Camera.open();
Camera localCamera = this.camera_;
localCamera.getClass();
this.preSize_ = new Camera.Size(0,0);
Camera.Parameters localParameters = this.camera_.getParameters();
Iterator<Camera.Size> localIterator1 = localParameters.getSupportedPreviewSizes().iterator();
Camera.Size localSize2;
do
{
if (!localIterator1.hasNext())
break;
localSize2 = (Camera.Size)localIterator1.next();
this.preSize_ = localSize2;
}
while ((localSize2.width != this.previewWidth) && (localSize2.height != this.previewHeight));
localParameters.setPreviewSize(this.preSize_.width, this.preSize_.height);
Iterator<Camera.Size> localIterator2 = localParameters.getSupportedPictureSizes().iterator();
Camera.Size localSize1;
do
{
if (!localIterator2.hasNext())
break;
localSize1 = (Camera.Size)localIterator2.next();
this.procSize_ = localSize1;
}
while ((localSize1.width != this.processWidth) && (localSize1.height != this.processHeight));
localParameters.setPictureSize(this.procSize_.width, this.procSize_.height);
this.camera_.setParameters(localParameters);
this.camera_.setDisplayOrientation(90);
try
{
this.camera_.setPreviewDisplay(this.surfaceHolder_);
this.camera_.startPreview();
return;
}
catch (Exception localException)
{
while (true)
localException.printStackTrace();
}
}