【发布时间】:2013-12-04 18:13:31
【问题描述】:
// Get the camera
private void getCamera() {
if (camera == null) {
try {
camera = Camera.open();
params = camera.getParameters();
} catch (RuntimeException e) {
Log.e("Camera Error. Failed to Open. Error: ", e.getMessage());
}
}
}
// Turning On flash
private void turnOnFlash() {
if (!isFlashOn) {
if (camera == null || params == null) {
return;
}
// play sound
playSound();
params = camera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_TORCH);
camera.setParameters(params);
camera.startPreview();
isFlashOn = true;
// changing button/switch image
toggleButtonImage();
}
}
上面是我与 flash on 相关的代码,任何建议,如何让 flash 在我的应用打开时不打开,但只有在我按下按钮时才打开
【问题讨论】:
-
那么在您的代码中,
turnFlashOn()是从哪里调用的? -
你不能帮我吗? ://
-
不,因为您没有在任何调用
turnFlashOn()的地方包含代码。如果你有,我就不会问电话是从哪里来的。 :-) 搜索您的代码,并找出调用turnFlashOn()的位置(不是定义,而是调用)。
标签: flashlight