关于Android 7.0(API24)相机的问题汇总

在开发Android项目的时候,我们会用到相机,有些时候只是开发一个普通的扫码,仅仅赋予一下 权限 就好了,但是有些时候是需要拍照和从相册中获取照片的。

我们在Android 5.0以及5.0之前调用相机可以这样写

Intent intent = new Intent(); intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE); File savePhoto = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"/test/"+System.currentTimeMillis() + ".png"); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(savePhoto)); startActivityForResult(intent,200);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwzzys.html