Android App 中实现照片拍摄的简单方法

在 Android App 开发中,需要实现照片拍摄,可尝试以下方法:

1、参考下面这个文档(来自:https://developer.android.google.cn/training/camera/photobasics#java)
在这里插入图片描述

2、调用下图所示这段 拍照 Intent ,实现照片拍摄功能
在这里插入图片描述

3、调用下图所示代码,将拍摄到的照片缩略图放到指定的照片展示区域( imageView)
在这里插入图片描述

注意:来自“data”的是缩略图,处理全尺寸的图像还需要做些工作。具体见后面说明部分。


说明

该文档中后面部分还介绍了:Save the full-size photo、Add the photo to a gallery、Decode a scaled image(保存全尺寸照片、将照片添加到图库中、解码缩放后的图像)等方法。


小结

这一方法相比网络上找到的其他方法,更简单实用。

猜你喜欢

转载自blog.csdn.net/weixin_44769108/article/details/88562151