简体   繁体   中英

Application is crashing while calling camera.setParameters(parameters);

In my android application I am using custom camera with effects. While i am calling

parameters.setColorEffect(Camera.Parameters.EFFECT_NEGATIVE);
camera.setParameters(parameters);

the application is working well but while I am calling

parameters.setColorEffect(Camera.Parameters.EFFECT_BLACKBOARD);
camera.setParameters(parameters);

the application leads to the following exception

01-21 17:32:13.656: E/AndroidRuntime(5932): java.lang.RuntimeException: setParameters failed
01-21 17:32:13.656: E/AndroidRuntime(5932):     at android.hardware.Camera.native_setParameters(Native Method)
01-21 17:32:13.656: E/AndroidRuntime(5932):     at android.hardware.Camera.setParameters(Camera.java:1494)

Can anyone help me.

Thanks.

It means the EFFECT_BLACKBOARD is not supported by your device. You must check whether the ColorEffect is supported by your Device.

CameraParameters.getSupportedColorEffects();

And check if it contains your effect then apply it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM