美文网首页
Android6.0机型上调用系统相机拍照返回的resultCo

Android6.0机型上调用系统相机拍照返回的resultCo

作者: Bount林 | 来源:发表于2019-11-19 10:03 被阅读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机型上调用系统相机拍照返回的resultCo

      本文链接:https://www.haomeiwen.com/subject/qngovftx.html