正在从对话框按钮启动相机意图,它在 90% 的时间内成功。另外 10% 的时间在拍照前意图启动和关闭。权限已打开,不显示错误消息,并且正在使用 android 6 . 什么事件可能导致这种偶尔失败?
Intent takePicture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePicture.resolveActivity(getPackageManager()) != null) {
alertDialog.cancel();
startActivityForResult(takePicture, REQUEST_IMAGE_CAPTURE);
}