I have two Activities first activity has the dynamic image view and on click i am calling the second activity where camera in invoked to capture a image, now i am able to invoke camera and capture a image but how would i pass that image to the previous activity and set to the image view.
String fileName = "testphoto.jpg";
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.TITLE, fileName);
values.put(MediaStore.Images.Media.DESCRIPTION,
"Image capture by camera");
values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
imageUri = getContentResolver().insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
startActivityForResult(intent, IMAGE_CAPTURE);
Finally I achieve using two activities with the help of
startActivityForResult.check below piece code, hope its helpful you:
main.xml
FirstActivity.java
It will open second activity with
startActivityResultSecondActivity.java
Here when its called it will directly open
cameraIntentand withinonActivityResultit will return back to Firstactivity with your outputManifest.xml