0

I want the App to Create a Folder in the SD card, when the user presses the button.

I added the Manifest Code:

Here is My Java Code:

public void onClick(View v) {

                File path = new File(Environment.getExternalStorageDirectory()+File.separator+"Naya");
                if (!path.exists()) {
                    path.mkdir();
                        // do something                        
                }
            }

No Folder gets Created and it shows "mkdir() is ignored". Thank You.

Kasım Özdemir
  • 5,414
  • 3
  • 18
  • 35
Abhishek
  • 33
  • 7
  • Does this answer your question? [Android java : How to create folder inside android devices?](https://stackoverflow.com/questions/22320346/android-java-how-to-create-folder-inside-android-devices) – Raushan May 10 '20 at 13:33

1 Answers1

0

Did you add these to your manifest?

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

from here and here

antonbiz
  • 11
  • 1
  • Tried, The Method is Deprecated now, So I had to lower my API version as I don't know about the new Methods – Abhishek Jul 11 '20 at 14:01