Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create a directory in External SD in android application
    primarykey
    data
    text
    <p>I want to create a directory on "/mnt/extsd/MyFolder" this path. while calling mkdir() it returns false.I inserted the sdcard on my tablet, got the external path as "/mnt/extsd" and trying to create a folder on this path. Below is my code,</p> <pre><code>File lSDCardDirFile = new File("/mnt/extsd/MyFolder"); if (!lSDCardDirFile.exists()) { System.out.println("Is folder created --- " + lSDCardDirFile.mkdirs()); } </code></pre> <p>I gave the permissions, . I want to create the folder in External sd card which is removable sd card. I am using android 4.0 ICS version device.</p> <p>I created a different method for getting paths fom external SD card,</p> <pre><code> public static String[] getStorageDirectories() { String[] lDirs = null; BufferedReader lBufferReader = null; try { lBufferReader = new BufferedReader(new FileReader("/proc/mounts")); ArrayList list = new ArrayList(); String lStrline; while ((lStrline = lBufferReader.readLine()) != null) { if (lStrline.contains("vfat") || lStrline.contains("/mnt")) { StringTokenizer lTokenizer = new StringTokenizer(lStrline, " "); String lStrPath = lTokenizer.nextToken(); lStrPath = lTokenizer.nextToken(); // Take the second token, i.e. mount point if (lStrPath.equals(Environment.getExternalStorageDirectory().getPath())) { list.add(lStrPath); } else if (lStrline.contains("/dev/block/vold")) { if (!lStrline.contains("/mnt/secure") &amp;&amp; !lStrline.contains("/mnt/asec") &amp;&amp; !lStrline.contains("/mnt/obb") &amp;&amp; !lStrline.contains("/dev/mapper") &amp;&amp; !lStrline.contains("tmpfs")) { list.add(lStrPath); } } } } lDirs = new String[list.size()]; for (int i = 0; i &lt; list.size(); i++) { lDirs[i] = (String) list.get(i); } } catch (FileNotFoundException e) {} catch (IOException e) {} finally { if (lBufferReader != null) { try { lBufferReader.close(); } catch (IOException e) { } } } return lDirs; }` </code></pre> <p>From this method I got the path, but while trying to create a directory, the mkdir() returns false.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload