I have a camera application that I could do with some help with. In my Camera Fragment I call the method takePicture, which I is meant to pause the preview (according to the API).
我有一个相机应用程序,我可以做一些帮助。在我的相机片段中,我调用方法takePicture,我打算暂停预览(根据API)。
On my old HTC One X this was true, but having just upgraded to an HTC One mini2 the preview no longer pauses.
在我的旧HTC One X上这是真的,但刚刚升级到HTC One mini2,预览不再停顿。
Is there a logical reason for this? Any suggested changes to my code?
这有合理的原因吗?我的代码有任何建议的更改吗?
I am calling takePicture with the following code:
我用以下代码调用takePicture:
if (myCamera != null) {
FragmentManager fm = getFragmentManager();
PhotoHandler myphotohandler = new PhotoHandler(fm, mycontext, getView(), Photo_Type, photonumber, getDir(Project_Name), lmanager, projecttag);
ShutterCallback shutter = new ShutterCallback() {
public void onShutter() {
button_takephoto = (ImageButton) getView().findViewById(R.id.button_takephoto);
button_takephoto.setImageResource(R.drawable.shutter_closed);
}
};
myCamera.takePicture(shutter, null, null, myphotohandler);
And my PhotoHandler class implements the PictureCallback.
我的PhotoHandler类实现了PictureCallback。
Any suggestions or similar experiences would be appreciated.
任何建议或类似的经验将不胜感激。
1 个解决方案
#1
0
A solution I found is to manually stop the preview in a Camera.ShutterCallback. Originally, I had only a Camera.PictureCallback handling my apps response to a picture being taken.
我找到的解决方案是在Camera.ShutterCallback中手动停止预览。最初,我只有一个Camera.PictureCallback处理我的应用程序对正在拍摄的照片的响应。
if (myCamera != null) {
PhotoHandler myphotohandler = new PhotoHandler();
ShutterCallback shutter = new ShutterCallback() {
public void onShutter() {
myCamera.stopPreview();
}
};
myCamera.takePicture(shutter, null, null, myphotohandler);
}
#1
0
A solution I found is to manually stop the preview in a Camera.ShutterCallback. Originally, I had only a Camera.PictureCallback handling my apps response to a picture being taken.
我找到的解决方案是在Camera.ShutterCallback中手动停止预览。最初,我只有一个Camera.PictureCallback处理我的应用程序对正在拍摄的照片的响应。
if (myCamera != null) {
PhotoHandler myphotohandler = new PhotoHandler();
ShutterCallback shutter = new ShutterCallback() {
public void onShutter() {
myCamera.stopPreview();
}
};
myCamera.takePicture(shutter, null, null, myphotohandler);
}