Android examples for Camera:Front Camera
get Front Camera Instance
import android.annotation.SuppressLint; import android.hardware.Camera; public class Main{ public static Camera getCameraInstance() { int cameraCount = 0; Camera cam = null;/* w w w .ja va 2 s . c o m*/ Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); cameraCount = Camera.getNumberOfCameras(); for (int camIdx = 0; camIdx < cameraCount; camIdx++) { Camera.getCameraInfo(camIdx, cameraInfo); if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { try { cam = Camera.open(camIdx); } catch (RuntimeException e) { Log.d("FAIL CAMERA", e); } } } return cam; } }