How to resume android camera preview after onPictureTaken function?

血红的双手。 提交于 2019-12-10 13:43:02

问题


I am developing an app that take pictures from camera object and save it to the sdcard. It works great except some things.(I cant config some parameters for example resolution). But when I take picture it freeze on the screen. I just want to resume the preview and capturing same way after I take picture. here is the full code : http://bahacanaydin.blogspot.com/2012/05/package-com.html


回答1:


You have to put mCamera.startPreview(); inside your onPictureTaken() function to restart preview again, because it stops automatically when the picture is taken.




回答2:


Maybe this will help. From Android SDK documentation on takePicture():

After calling this method, you must not call startPreview() or take another picture until the JPEG callback has returned.

The JPEG callback is implementation of onPictureTaken(), as I understand. So you should defer your call to startPreview.




回答3:


mCamera.takePicture(null, null, mPicture);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//Do something after 1000ms
       mCamera.startPreview();
           }
     }, 1000);


来源:https://stackoverflow.com/questions/10488788/how-to-resume-android-camera-preview-after-onpicturetaken-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!