0

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_CANDLELIGHTand 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();
}

2 Answers2

1

Your device does not support CANDLELIGHT or SOLARIZE, but it does support BEACH and WHITEBOARD. Why is this strange?

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • thank you for answering. but is there any way to know the supported modes by my mobile? –  Apr 24 '14 at 20:30
  • I often find answers to such questions at http://androidfragmentation.com/database. But if you have the device in hand, you can easily find out: launch the system Camera app and look which modes and effects it allows to choose. If you use an official ROM, the chances are 95% that all possible settings will be reflected by the Camera app. – Alex Cohn Apr 25 '14 at 12:11
0

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.

Eddy Talvala
  • 17,243
  • 2
  • 42
  • 47