Created
February 13, 2013 04:49
-
-
Save DavidTPate/4942380 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
private Camera getCameraInstance() { | |
try { | |
// attempt to get a Camera instance | |
// this will open the default camera, which is the back-facing camera (if it exists) | |
mCamera = Camera.open(); | |
// need to handle the Media Server Dying | |
mCamera.setErrorCallback(getErrorCallback()); | |
Log.d(TAG, "Camera Opened Successfully"); | |
} catch (RuntimeException e) { | |
Log.d(TAG, "Failed to Open Camera - " + e.getMessage()); | |
// Camera is not available (in use or does not exist) | |
} | |
return mCamera; // returns null if camera is unavailable | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment