I Creating custom camera app i am using Surfaceview. In my app i capture the picture but it work perfectly in Note 4 and it problematic in xiaomi mobile and i don't the reason why this happen.
Note 4 onPictureTaken Byte[] size is original.
BUT
xiaomi onPictureTaken Byte[] size is always 160x120
Here is my code
PictureCallback mPicture = new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
final BitmapFactory.Options sizeOptions = new BitmapFactory.Options();
// sizeOptions.inJustDecodeBounds = false;
sizeOptions.inScaled = false;
// sizeOptions.inDither = false;
sizeOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
BitmapFactory.decodeByteArray(data, 0, data.length, sizeOptions);
Log.d("onPictureTaken", "Bitmap is " + sizeOptions.outWidth + "x"
+ sizeOptions.outHeight);
int angleToRotate = getRoatationAngle(currentCameraId);
Log.d("Tag", "Rotation angle: " + angleToRotate);
if (currentCameraId == Camera.CameraInfo.CAMERA_FACING_FRONT)
angleToRotate = angleToRotate + 180;
final String albumId = Util.ReadSharePrefrence(getActivity(), Constant.SHRED_PR.KEY_Current_AlbumID);
new SavePhotoTask(albumId, data, angleToRotate, isChecked, orientation).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
camera.startPreview();
}
};
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…