@Override public void onPictureTaken(byte[] data, android.hardware.Camera camera) { Log.d(DEBUG_TAG, "ImageDataSize= " + String.valueOf(data.length)); // Save the image in memory: resize if it is necessary (Solve BUG APPLICARTE-264) // to compress the image for send to PreviewActivity Bitmap imageBitmap = BitmapFactory.decodeByteArray(data, 0, data.length); Log.d( DEBUG_TAG, "Bitmap size pre-resize = " + String.valueOf(data.length) + " height= " + imageBitmap.getHeight() + " width= " + imageBitmap.getWidth()); if (!(mCheckResult.isSupportedSize()) && (mCheckResult.isResize())) { imageBitmap = Bitmap.createScaledBitmap( imageBitmap, mCheckResult.getWidthResize(), mCheckResult.getHeightResize(), false); // size --> log Log.d( "BitmapUtils Debug", "Bitmap size resize = " + String.valueOf(imageBitmap.getRowBytes() * imageBitmap.getHeight()) + " height= " + imageBitmap.getHeight() + " width= " + imageBitmap.getWidth()); } // Show the image in Preview Screen ByteArrayOutputStream bos = new ByteArrayOutputStream(); imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos); // size --> log byte[] imageInByte = bos.toByteArray(); Log.d( DEBUG_TAG, "Bitmap size = " + String.valueOf(imageInByte.length) + " height= " + imageBitmap.getHeight() + " width= " + imageBitmap.getWidth()); // To take more photos in the future previewCamera(); }
@SuppressWarnings("static-access") @Override public void surfaceCreated(SurfaceHolder holder) { // initialize the camera mCamera = Camera.open(); // parameters : set picture size mParameters = mCamera.getParameters(); // flash off if (mCheckResult.getFlashMode() != null) { mParameters.setFlashMode(mParameters.FLASH_MODE_OFF); } mCamera.setParameters(mParameters); // start the preview on surface previewCamera(); }