0

by using this Stack OverFlow Answer (FOR SDK 30 AND ABOVE) I well able to retrieve the number of media files present in the .Status Folder on Android 11

But When I set the path to Imageview, image view Show Blanks

WAStatusModel fileItem = fileArrayList.get(i);
 File backupFile = new File( fileItem.getPath() );
        Uri imageUri = Uri.fromFile(backupFile);    
Glide.with(context)
                .load(imageUri)
                .into(viewHolder.imgpc);

I Also Try with the provider But no effect i.e

 Uri photoURI = FileProvider.getUriForFile(context, context.getPackageName() + ".provider", backupFile);
Glide.with(context)
                    .load(photoURI)
                    .into(viewHolder.imgpc);

My Output paths are:: imageUri is

 file:///storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media/.Statuses/img.jpg

fileItem.getUri() is

content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia/document/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2F.Statuses%2Fimg.jpg

and fileItem.getPath() is

/storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media/.Statuses/img.jpg

image is not Loaded in Adapter. How it is possible. Plz Help Me

Areeba Qurashi
  • 119
  • 1
  • 8
  • You should use the uri for the file itself to access the file. You tried to get 'a real path' for an uri. Which is a bad idea but you managed to get a path indeed. But you can do nothing with that path as you have discovered as you have no read permission for it. – blackapps Mar 21 '22 at 13:24
  • @blackapps are You Mean i use fileItem.getUri() – Areeba Qurashi Mar 21 '22 at 17:54
  • If that gives you the uri of the file then yes. You put the uries in the list. Now use them one by one. – blackapps Mar 21 '22 at 18:28
  • Thanks, Probleme is Solve i get All the Files – Areeba Qurashi Mar 21 '22 at 19:22

0 Answers0