android前置摄像头的调用
2015-01-16 01:16
621 查看
第一种,MediaStore调用原生摄像头,不过既然是原生摄像头,就必须是原生系统,此方法就当没说
第二种,Camera.open(),废话不说,看代码
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra("camerasensortype", 2); // 调用前置摄像头 intent.putExtra("autofocus", true); // 自动对焦 intent.putExtra("fullScreen", false); // 全屏 intent.putExtra("showActionIcons", false); startActivityForResult(intent, 1);
第二种,Camera.open(),废话不说,看代码
int cameraCount = 0; Camera cam = null; 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 ) { // 代表摄像头的方位,目前有定义值两个分别为CAMERA_FACING_FRONT前置和CAMERA_FACING_BACK后置 try { cam = Camera.open( camIdx ); } catch (RuntimeExceptione) { e.printStackTrace(); } }
相关文章推荐
- 在Android系统中调用系统前置摄像头
- android 调用系统前置摄像头
- Android 调用前置摄像头[原创]
- Android 调用前置摄像头
- Android 调用前置摄像头
- Android 调用前置摄像头的方法
- 【Android基础】-调用前置摄像头实现的‘手机镜子’
- 如何在Android系统中调用系统前置摄像头
- 在Android系统中调用系统前置摄像头
- android-摄像头-调用前置摄像头
- 【Android代码片段04】调用前置摄像头
- Android2.2及2.3版本调用前置摄像头
- Android调用前置摄像头的方法
- Android调用前置摄像头的方法
- 在Android系统中调用系统前置摄像头
- android 调用系统前置摄像头
- Android 调用前置摄像头
- android 调用系统前置摄像头
- Android2.2及2.3版本调用前置摄像头
- Android调用系统摄像头--使用MediaRecorder--2--使用MediaRecorder进行录制