Open camera through intent in Android

Open camera through intent in Android

First, create a button to open the camera and an image view on which the captured image should be visible image.png

Create a new ActivityResultLauncher object which will handle the case after the image has been captured. image.png

Now complete the openCamera() functionality as follows image.png