I do not know why logact generates error when i set the camera parameters regarding setSceneMode
and setColorEffect
as show below, and says set parameters failed
but when I set the aforementioned methods to SCENE_MODE_CANDLELIGHT
and EFFECT_SOLARIZE
respectively it works
JavaCode:
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,int height) {
// TODO Auto-generated method stub
android.hardware.Camera.Parameters camParameter = this.myCamera.getParameters();
camParameter.setSceneMode(Parameters.SCENE_MODE_BEACH);
camParameter.setColorEffect(Parameters.EFFECT_WHITEBOARD);
camParameter.setFlashMode(Parameters.FLASH_MODE_AUTO);
camParameter.setPreviewSize(width/2, height/2);
camParameter.setPictureSize(width/2, height/2);
myCamera.setParameters(camParameter);
myCamera.startPreview();
}
In general, the Camera.Parameters class can be queried for this information at runtime for any given camera device. Note that the front and back cameras don't necessarily have the same supported modes, so you always have to get the parameters from the camera after you open it to inspect what's supported.
Specifically, you can use Camera.Parameters.getSupportedColorEffects() and Camera.Parameters.getSupportedSceneModes() to find out which of the effects and scene modes your current device supports.