android相机单击连续拍摄 [英] android camera click continous shots
问题描述
我正在尝试制作能连续拍摄3张照片的相机.
I am trying to make camera application which takes 3 continuous shots.
我试图将其放入一个循环中多次调用"takePicture".
i have tried to call "takePicture" several times by putting it in a loop.
但没有成功.
请对此事提供帮助.
我们将不胜感激.
推荐答案
永远不要从代码中调用PictureCallback.onPictureTaken()
;此回调在就绪后会从系统接收数据,作为对Camera.takePicture()
的响应.
You never should call PictureCallback.onPictureTaken()
from your code; this callback receives data from the system when it is ready, as response to Camera.takePicture()
.
仅当打开相机并开始预览时,后一个调用才会成功.因此,仅在循环中调用Camera.takePicture()
将不起作用(请参见例如
The latter call will only succeed if the camera is opened and preview is started. Therefore, simply calling Camera.takePicture()
in a loop will not work (see e.g. Android 2.3.1 Camera takePicture() Multiple images with one button click). The correct way to handle this is to keep a counter of shots processed in your onPictureTaken()
, and if it is less than 3, then restart camera preview and issue (synchroneously) another Camera.takePicture()
. After this, onPictureTaken()
should return
, to allow processing of the next captured frame.
这篇关于android相机单击连续拍摄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!