0

I need to take a picture from camera where it goes to another activity where we have image view to show the picture taken through camera.My questions is how to pass image data through intents using camera2api?

In which method in camera2api i need to pass data for another activity?

1 Answers1

0

You don't need Intent to pass image data from one Activity of your app to another. Actually, you cannot use Intent to pass a picture: there are restrictions on the size of the data bundled with Intent. So, you can use Intent extras to pass the path to an image, or some parameters extracted from the image. The Camera app uses intent extra("data") to return a thumbnail (very small) image.

Using the standard MediaStore.ACTION_IMAGE_CAPTURE Intent for latest devices which feature hardware.camera2 API is not different from the older devices that used the deprecated hardware.Camera.

You can employ some private Intent-based mechanism to communicate between activities of your app. In this case the consumer will probably pass necessary parameters to capture activity with startActivityForResult() and get the results in onActivityResult(). There are no methods in hardware.camera2 that can (or could be expected to) help you with these tasks.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • I am using a custom camera layout where i cannot use the inbuilt camera features or on activty for result because i need to send image data to other activity i got the answer yesterday i am sending image uri from intents get the image back Anyway thanks for answer – Latheesh Reddy Jun 08 '17 at 14:17
  • Yes, as I wrote above you can pass image URI with Intent, but not the image itself – Alex Cohn Jun 08 '17 at 15:13