In my application i want to open the gallery and choose an image from it. So i do
gallery.setOnClickListener {
val imageIntent = Intent().apply {
type = "image/*"
action = Intent.ACTION_PICK
}
startActivityForResult(
Intent.createChooser(imageIntent, "Select an image"), IMAGE_REQUEST_CODE
)
}
However, when i choose an image i want the user to be able to preview the image that he selected before i get it in the ActivityResult. In some devices and some apps (Google Photos) they do this by default, but in other devices i can't get that feature. How can i have this functionality by default in every device?
How can i have this functionality by default in every device?
You can't.
You are starting an activity from a third-party app. What the third-party app does is up to the developers of the third-party app.
In some cases, there are Intent
extras that provide hints as to what we want the third-party app to do. In this case, there is no standard "please provide a full-screen preview" extra. And, even if there were, there is no requirement for any given ACTION_PICK
activity to pay attention to that extra.