Skip to content Skip to sidebar Skip to footer

Android : Camera.getparameters() Crashes App

i'm using this code to use the camera LED as flashlight but it crashes when the service starts. Using Log.w() statements i found it stops at param = camera.getParameters();. i hav

Solution 1:

Add a condition to check if the object is null first:

camera = Camera.open();
if (camera.getParameters()!=null) {
    Camera.Parametersparam= camera.getParameters();
}

Solution 2:

Your camera object is null at camera.getParameters(). Call Camera.open() in order to use it.

Post a Comment for "Android : Camera.getparameters() Crashes App"