[UPDATE] folder found in this path: /sdcard/myfolder and could download images into it but they don't show in the studio.
I'm trying to create a folder on SD Card to download files using code from this answer using a real device with Android 7
File folder = new File(Environment.getExternalStorageDirectory() + "/myfolder");
boolean success = true;
if (!folder.exists()) {
success = folder.mkdirs();
Toast.makeText(Main3Activity.this,"folder does not exist",Toast.LENGTH_SHORT).show();
}
if (success) {
Toast.makeText(Main3Activity.this,"success",Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(Main3Activity.this,"error",Toast.LENGTH_SHORT).show();
}
AndroidManifest permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
I get the request permission message and I grant permission then when I execute the code I get a success message but can't find the folder on SD Card at all so what's wrong with this code?