Search code examples
androidcameraoverlay

Need to show a custom shape overlay in the in-built camera application


I am trying to show a custom shape overlay in the in-built camera application which I am opening by intent as I want the user take the photo inside that shape only. I have already created the overlay by using onDraw() method of my class which extends to view. How can I show the overlay in that camera? I found a few solutions, but all them are using either using Camera2 or CameraX to do this. But, I want to do this while using the in-built camera. I am calling this function in my clickListener of the button which opens the camera.

private fun dispatchTakePictureIntent() {
    val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
    startActivityForResult(intent, REQUEST_CODE)
}

Solution

  • Unfortunately this isn't possible. You cannot modify other applications with your own drawing code.