Home | History | Annotate | Download | only in camera

Lines Matching defs:Camera

17 package com.example.android.basicpermissions.camera;
22 import android.hardware.Camera;
28 * Displays a {@link CameraPreview} of the first {@link Camera}.
29 * An error message is displayed if the Camera is not available.
31 * This Activity is only used to illustrate that access to the Camera API has been granted (or
36 * http://developer.android.com/guide/topics/media/camera.html
43 * Id of the camera to access. 0 is the first camera.
48 private Camera mCamera;
54 // Open an instance of the first camera and retrieve its info.
56 Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
57 Camera.getCameraInfo(CAMERA_ID, cameraInfo);
60 // Camera is not available, display error message
61 Toast.makeText(this, "Camera is not available.", Toast.LENGTH_SHORT).show();
81 // Stop camera access
85 /** A safe way to get an instance of the Camera object. */
86 private Camera getCameraInstance(int cameraId) {
87 Camera c = null;
89 c = Camera.open(cameraId); // attempt to get a Camera instance
91 // Camera is not available (in use or does not exist)
92 Toast.makeText(this, "Camera " + cameraId + " is not available: " + e.getMessage(),
95 return c; // returns null if camera is unavailable
100 mCamera.release(); // release the camera for other applications