My app allows the user to press a button, it opens the camera, they can take a photo and it will show up in an imageview. If the user presses back or cancel while the camera
For Kotlin Users
You just need to add ? with Intent in onActivityResult as the data can be null if user cancels the transaction or anything goes wrong. So we need to define data as nullable in onActivityResult
Just replace onActivityResult signature of SampleActivity with below:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?)