The issue with front camera was figured out to be specific to android 4.0+.
So after you decoded the byte-array in method "onPictureTaken"
@Override
public void onPictureTaken(byte[] data, Camera camera) {
Bitmap photo = BitmapFactory.decodeByteArray(data,0,data.length);
photo = rotateBitmap(photo); //.....do some stuff }
just call rotateBitmap to rotate the bitmap
private Bitmap rotateBitmap(Bitmap bitmap){
Matrix rotateRight = new Matrix();
rotateRight.preRotate(90);
if(android.os.Build.VERSION.SDK_INT > 13 && CameraActivity.frontCamera)
{
float[] mirrorY = { -1, 0, 0, 0, 1, 0, 0, 0, 1};
rotateRight = new Matrix();
Matrix matrixMirrorY = new Matrix();
matrixMirrorY.setValues(mirrorY);
rotateRight.postConcat(matrixMirrorY);
rotateRight.preRotate(270);
}
final Bitmap rImg= Bitmap.createBitmap(bitmap, 0, 0,
bitmap.getWidth(), bitmap.getHeight(), rotateRight, true);
return rImg;
}