Android6.0机型上调用系统相机拍照返回的resultCode值始终等于0的问题]

原文链接

1.返回时Activity生命周期走onPause()--onStop()--onDestory(),在 onPause()方法中设置

@Override

protected void onPause() {

super.onPause();

LogUtil.e("Tag","======onPause");

if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏

    }
}
@Override

protected void onResume() {

super.onResume();

LogUtil.e("Tag","======onResume");

if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);//横屏


}

你可能感兴趣的:(Android6.0机型上调用系统相机拍照返回的resultCode值始终等于0的问题])