How can I open the default Android Gallery to display some images that I store in my Application's internal storage folder for example data.com.myapp.appname.files.images
?
I have tried a couple of ActivityResultContract
but I either get a file explorer to pick media files or i open gallery and i get Access Denied
although i have passed authority
when creating the Uri.
However, I can successfully view a single picture from the internal storage and if i change the uri to the internal folder it will launch gallery but will just display a blank picture (a null picture with the gray background).
Is it doable at all?
Codes sample:
val intent = Intent(Intent.ACTION_VIEW)
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setDataAndType(
FileProvider.getUriForFile(
requireContext(),
"com.company.ApplicationName.provider",
fileAccessModule.getInternalImagesDir()
), "image/*"
)
startActivity(intent)