private void setRightCameraOrientation(int cameraId, Camera mCamera) {CameraInfo info = new android.hardware.Camera.CameraInfo();Camera.getCameraInfo(cameraId, info);int rotation = this.getWindowManager().getDefaultDisplay().getRotation();int degrees = 0;switch (rotation) {case Surface.ROTATION_0:degrees = 0;break;case Surface.ROTATION_90:degrees = 90;break;case Surface.ROTATION_180:degrees = 180;break;case Surface.ROTATION_270:degrees = 270;break;}//int result;if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {result = (info.orientation + degrees) % 360;result = (360 - result) % 360; // compensate the mirror} else { // back-facingresult = (info.orientation - degrees + 360) % 360;}mCamera.setDisplayOrientation(result);}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android比较特殊的错误或警告集锦
  2. Android高仿微信联系人字母导航栏的实现
  3. Android(安卓)自定义Spinner显示条目与下
  4. [Android]结合MediaPlayer和Service的音
  5. 代码实现android的一个登录界面
  6. Netty 之Oio程序编写
  7. android Activity窗体显示状态设置
  8. Android(安卓)MediaRecorder录制音频的方
  9. android异常:Consumer closed input chan
  10. Android(安卓)倒计时工具类