Issue
Eclipse show me error The operator && is undefined for the argument type(s) boolean, int
what`s going wrong here and how to fix this? I must use this code to fix front camera upside-down issue in Android 4.
public static Bitmap createRotatedBitmap(Bitmap bm, float degree) {
Bitmap bitmap = null;
if (degree != 0) {
Matrix matrix = new Matrix();
matrix.preRotate(degree);
if(android.os.Build.VERSION.SDK_INT>13 && Camera.CameraInfo.CAMERA_FACING_FRONT)
{
float[] mirrorY = { -1, 0, 0, 0, 1, 0, 0, 0, 1};
matrix = new Matrix();
Matrix matrixMirrorY = new Matrix();
matrixMirrorY.setValues(mirrorY);
matrix.postConcat(matrixMirrorY);
matrix.preRotate(270);
}
bitmap = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
}
return bitmap;
}
Solution
The value Camera.CameraInfo.CAMERA_FACING_FRONT is a int-value and you can use logical operators as && only with booleans
Try to use Camera.CameraInfo.facing.equals(Camera.CameraInfo.CAMERA_FACING_FRONT)
Answered By - Sara S
Answer Checked By - Pedro (JavaFixing Volunteer)