I have a camera overlay(Imageview) on my custom camera currently. I have got everything working. Now just need to get the image within the overlay. How do I go about doing this. Did a lot of research but didn't find an efficient way to do it.
P.S. If you are giving me negative points please also state the reason.
private Camera.PictureCallback mJPEGPictureCallback = new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
CameraConfigurationUtils.releaseCamera();
ProcessImageAsyncTask processImageAsyncTask = new ProcessImageAsyncTask(CameraActivity.this);
processImageAsyncTask.setTaskCompletedListener(new ProcessImageAsyncTask.OnImageProcessingCompletedInterface() {
@Override
public void onImageProcessComplete(Bitmap bitmap) {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
enablePreviewMode();
bitmap = Bitmap.createBitmap(bitmap, transparentView.getHeight(), transparentView.getLeft(), transparentView.getWidth(), transparentView.getHeight());
cameraPreviewImage.setImageBitmap(bitmap);
File pictureFile = CameraImageUtils.getOutputMediaFile();
if (pictureFile == null) {
Log.d(TAG, "Error creating media file, check storage permissions: ");
return;
}
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 70, fos);
fos.flush();
fos.close();
Toast.makeText(getApplicationContext(), "Picture size in " + ((float) (pictureFile.length()) / (1024 * 1024)) + " mb", Toast.LENGTH_SHORT).show();
} catch (FileNotFoundException e) {
Log.d(TAG, "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d(TAG, "Error accessing file: " + e.getMessage());
}
}
});
processImageAsyncTask.execute(data);
}
};