Changed my code from using deprecated Camera class to CameraDevice and now have the errors indicated ("<-- here"). What is the best alternative for replacing these parameters? Looking at the documentation it seems that, at least for the orientation, a sensor is the appropriate option but that seems an overly complicated response.
public void surfaceCreated(SurfaceHolder holder) {
// The Surface has been created, now tell the camera where to draw the preview.
try {
mCamera.setDisplayOrientation(90); <-- here
mCamera.setPreviewDisplay(holder); <-- here
mCamera.startPreview(); <-- here
} catch (IOException e) {
Log.d(TAG, "Error setting camera preview: " + e.getMessage());
}
}
and
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
// If your preview can change or rotate, take care of those events here.
// Make sure to stop the preview before resizing or reformatting it.
if (mHolder.getSurface() == null){
// preview surface does not exist
return;
}
// stop preview before making changes
try {
mCamera.stopPreview(); <-- here
} catch (Exception e){
// ignore: tried to stop a non-existent preview
}
// set preview size and make any resize, rotate or
// reformatting changes here
// start preview with new settings
try {
mCamera.setPreviewDisplay(mHolder); <-- here
mCamera.startPreview(); <-- here
} catch (Exception e){
Log.d(TAG, "Error starting camera preview: " + e.getMessage());
}
}