Created
February 13, 2013 04:47
-
-
Save DavidTPate/4942363 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
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 | |
Log.d(TAG, "Preview Surface does not exist"); | |
return; | |
} | |
// stop preview before making changes | |
try { | |
mCamera.stopPreview(); | |
Log.d(TAG, "Camera Stopped Successfully"); | |
} catch (Exception e) { | |
Log.d(TAG, "Error Stopping Camera, it most likely is 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); | |
mCamera.startPreview(); | |
Log.d(TAG, "Preview Started Successfully"); | |
} catch (Exception e) { | |
Log.d(TAG, "Error starting camera preview: " + e.getMessage()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment