i know this is a trivial question well answered using java, but i'm sure there are new APIs
to make things easier such as
val getContent = registerForActivityResult(GetContent()) { uri: Uri? ->
// Handle the returned Uri
}
and
val takePicture = registerForActivityResult(ActivityResultContracts.TakePicture()) { success: Boolean ->
if (success) {
// The image was saved into the given Uri -> do something with it
}
}
val imageUri: Uri = ...
button.setOnClickListener {
takePicture.launch(imageUri)
}
Q: How to implement the above question using kotlin and implementing the lastest APIs
for that
PS: this is question is still valid if answers provided become depreciated or obsolete.