I want to create a new folder in external storage. I use this code:
val folderMain = "name"
val f = File(getExternalStorageDirectory(), folderMain)
if (!f.exists()) {
f.mkdirs()
}
After executing it works and creates a new folder in internal storage, not in external storage. How can I create a new folder in external storage?
I am 100% sure I have external storage in my device and it has 14 GB space available in it and location is /storage/extSdCard
.
I have tested this code on two Samsung phones Android version jellybean and Kitkat but the same result.