1

I wish to view the files stored in my phone in my android application.

But I have just checked out the permission on the following folder in my phone:

/storage/emulated/0/DCIM/Camera/ : drwx rwx --x

Also the files in the above directory have got the permissions are
file1: -rw-rw----

Please help me out..! How can I be able to list the files in my above directory

The following code used to work for the Android 5. but the apps crashes now

File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
            String []list=file.list();
            for(String s : list){
                Log.d("YATES" , s);
            }
  • "This used to work for the Android 5" -- since you have not provided a [mcve], we cannot comment on what "this" is and whether it "used to work". "But I have just checked out the permission on the following folder" -- that is meaningless. If your `targetSdkVersion` is 23 or higher, make sure that [you are handling runtime permissions](https://developer.android.com/training/permissions/requesting.html). – CommonsWare Jul 10 '16 at 12:47
  • Modified Please check..! –  Jul 10 '16 at 12:54
  • First, `getExternalStoragePublicDirectory()` does not take `Environment.DIRECTORY_DCIM+"/Camera/"` as a value. Second, use LogCat to examine your Java stack trace associated with your crash: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this – CommonsWare Jul 10 '16 at 13:05
  • This is the reason I posted this question. Logcat doesn't show any error message.Sorry its Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) only –  Jul 10 '16 at 13:11
  • "Logcat doesn't show any error message" -- then you are not crashing. – CommonsWare Jul 10 '16 at 13:14

0 Answers0