节选自:Android自定义拍照实现
/**
* 注释:拍照并保存图片到相册
* 时间:2019/3/1 0001 15:37
* 作者:郭翰林
*/
private void takePhoto() {
isTakePhoto = true;
//调用相机拍照
mCamera.takePicture(null, null, null, (data, camera1) -> {
//视图动画
mPhotoLayout.setVisibility(View.GONE);
mConfirmLayout.setVisibility(View.VISIBLE);
AnimSpring.getInstance(mConfirmLayout).startRotateAnim(120, 360);
imageData = data;
//停止预览
mCamera.stopPreview();
});
}