I am using the jengelsma code from this post Capture Image from Camera and Display in Activity to get an image from the camera.
When I get the returned image it is o
start intent for camera
private void takeFromCamera() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
File exportDir = new File(Environment.getExternalStorageDirectory(), "TempFolder");
if (!exportDir.exists()) {
exportDir.mkdirs();
}
String fileName = "/" + UUID.randomUUID().toString().replaceAll("-", "") + ".jpg";
mTempCameraPhotoFile = new File(exportDir,fileName);
Log.d(LOG_TAG, fileName);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(mTempCameraPhotoFile));
startActivityForResult(takePictureIntent, REQUEST_CAMERA);
}
}
capture result in onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_CAMERA) {
if (requestCode == REQUEST_CAMERA) {
String filePath = mTempCameraPhotoFile.getPath();
Log.d(LOG_TAG, filePath);
/*
// extracted file path can be load into imageview for example with Picasso loader
Uri uri = Uri.fromFile(new File(mReportImageList.get(position).getUrl()));
Picasso.with(mContext)
.load(uri)
.fit()
.centerCrop()
.into(ivPhoto);*/
}
}
}
}
in manifest