Hi I am getting this issue only in OS versions below lollipop, searched a lot for this bit didn't found the right solution. I think the issue is with OS version Its working fine in 5+ my piece of code is
private void setCameraPhotoQuality(Camera camera) {
final Camera.Parameters parameters = camera.getParameters();
parameters.setPictureFormat(PixelFormat.JPEG);
if (configurationProvider.getMediaQuality() == Configuration.MEDIA_QUALITY_LOW) {
parameters.setJpegQuality(50);
} else if (configurationProvider.getMediaQuality() == Configuration.MEDIA_QUALITY_MEDIUM) {
parameters.setJpegQuality(75);
} else if (configurationProvider.getMediaQuality() == Configuration.MEDIA_QUALITY_HIGH) {
parameters.setJpegQuality(100);
} else if (configurationProvider.getMediaQuality() == Configuration.MEDIA_QUALITY_HIGHEST) {
parameters.setJpegQuality(100);
}
parameters.setPictureSize(photoSize.getWidth(), photoSize.getHeight());
camera.setParameters(parameters);
}
java.lang.RuntimeException: getParameters failed (empty parameters)
at android.hardware.Camera.native_getParameters(Native Method)
at android.hardware.Camera.getParameters(Camera.java:1662)