[Solved] Android java : How to create folder inside android devices?


3 step:

  1. To get sd card is mounted at /sdcard or any other location by using this way:

    Environment.getExternalStorageDirectory();
    
  2. You have to take uses-permission entry in the AndroidManifest.xml file:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    
  3. If directory already exists, then mkdir return false. Try creatinng new directory if it not exist:

    File folder = new File(Environment.getExternalStorageDirectory() + "/map");
    boolean success = true;
    if (!folder.exists()) {
        success = folder.mkdir();
    }
    if (success) {
        // Do something on success
    } else {
        // Do something else on failure 
    }
    

6

solved Android java : How to create folder inside android devices?