How to open image saved from gallery with content Uri?

Viewed 277

I'm using this to get an image Uri from the gallery.

getContent = registerForActivityResult(ActivityResultContracts.GetContent()) {
    viewModel.setUri(it.toString())
}

getContent.launch("image/*")

This get's this content://com.android.providers.media.documents/document/image%3A61

Then i save the Uri with room and show the image, all works fine, but then when i close the app and try to load the Uri from room.

And i get this error:

opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{4cae521 8688:com.example.app/u0a203} (pid=8688, uid=10203) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs

How do i access the previous saved Uri and show it?

0 Answers
Related