1

It's about a week that I upgrade my android version to 10 before that i can work whit files in my app but now I can't do anything such as:

Can't Create Folder

File internal = new File(String.valueOf(Environment.getExternalStorageDirectory().getAbsoluteFile()));
internal.mkdirs();

Can't Delete folder

File internal = new File(String.valueOf(Environment.getExternalStorageDirectory().getAbsoluteFile()));
    internal.delete();

Can't Get List of Folders In side It

File internal = new File(String.valueOf(Environment.getExternalStorageDirectory().getAbsoluteFile()));
    String[] internalFiles = internal.list();

please some one help me if you know how to solve this problem.

tohid noori
  • 191
  • 9

1 Answers1

0

As was first disclosed back in March 2019, you no longer have access by default to arbitrary locations on external storage or removable storage on Android 10+. add android:requestLegacyExternalStorage="true" to your manifest. Then will work.

tohid noori
  • 191
  • 9