Chapter 17: Taking Pictures With Intents - Problem Getting ActivityResult's Intent

No, it looks like you might have found a bug in our code. Your fix works well. Another option people could take is replacing the null with Uri.parse("") so you code looks like:

val captureImageIntent = takePhoto.contract.createIntent(
    requireContext(),
    Uri.parse(""),
)

That particular value isn’t really used by anything. It just needs to be there because the API needs something there in other use cases regarding communicating with other apps. Older versions of libraries allowed nullable types for that particular value, but it looks like it only accepts non-null Uris now.

2 Likes