kigojirego
Lurker
I am having a problem with using the flashlight and autofocus in my own camera app for android. I turn my flashlight on with this code:
This works fine. But when i focus the camera manually within the code by calling the following, the flashlight changes brightness.
I noticed that after i turn the flashlight on it starts with the highest brightness. After the first autofocus it gets darker and stays darker, after the second autocus it gets even darker than before and after the third autofocus it returns to the highest brightness. But when i turn on the flashlight outside my app in the home screen it works fine.
Does this happen to anyone else with an Samsung Galaxy S3 Mini? What could the problem be and how can i fix it?
EDIT: it looks like it has something to do with start- and stopPreview, becuase when i call
the brightness changes as well, but i still have no idea, why calling autofocus or start-, stopPreview affects the brightness of my led.
Code:
Camera.Parameters p = camera.getParameters();
p.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
camera.setParameters(p);
This works fine. But when i focus the camera manually within the code by calling the following, the flashlight changes brightness.
Code:
camera.autoFocus(new Camera.AutoFocusCallback() {
@Override public void onAutoFocus(boolean success, Camera camera) {
if (success) {
camera.setOneShotPreviewCallback(cameraPreviewCallback);
}
}
});
Does this happen to anyone else with an Samsung Galaxy S3 Mini? What could the problem be and how can i fix it?
EDIT: it looks like it has something to do with start- and stopPreview, becuase when i call
Code:
cam.stopPreview();
cam.startPreview();
Last edited: