My development phone is a Nexus 5
, running Android 4.4.2
.
In my application, I am attempting to create a folder on external storage that wi
First, new File()
is just create object for file connect.
you want use this file, file is exists or createNewFile()
.
If you want use this file to create directory, check file is exists, isDirectory()
after then mkDir()
.
Second, check Environment.getExternalStorageDirectory
is variable path.
You can use DDMS
or ADB
for work.
Additionaly, I think you add permission for read external storage for something error.
For Android 10+ add following into manifest:
<application
android:requestLegacyExternalStorage="true"
...
as asking for Manifest.permission.WRITE_EXTERNAL_STORAGE
is no more enough.