Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code> &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre> <p>I have two folders like extSdCard and sdcard in my samsung galaxy s3.</p> <p>Use the below code to choose.</p> <pre><code>private String[] mFilePaths; File storageDir = new File("/mnt/"); if(storageDir.isDirectory()){ File[] dirList = storageDir.listFiles(); for (int i = 0; i &lt; dirList.length; i++) { mFilePaths[i] = dirList[i].getAbsolutePath(); System.out.println("...................................."+mFilePaths[i]); } } File Dir; if(android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED))//check if sd card is mounted { Dir=new File(android.os.Environment.getExternalStorageDirectory(),"your folder name"); if(!Dir.exists())// if directory is not here Dir.mkdirs() // make directory } </code></pre> <p>Edit</p> <p>To get the paths of internal and external storage. below code works on samsung galaxy s3.</p> <pre><code>String externalpath = new String(); String internalpath = new String(); public void getExternalMounts() { Runtime runtime = Runtime.getRuntime(); try { Process proc = runtime.exec("mount"); InputStream is = proc.getInputStream(); InputStreamReader isr = new InputStreamReader(is); String line; BufferedReader br = new BufferedReader(isr); while ((line = br.readLine()) != null) { if (line.contains("secure")) continue; if (line.contains("asec")) continue; if (line.contains("fat")) {//external card String columns[] = line.split(" "); if (columns != null &amp;&amp; columns.length &gt; 1) { externalpath = externalpath.concat("*" + columns[1] + "n"); } } else if (line.contains("fuse")) {//internal storage String columns[] = line.split(" "); if (columns != null &amp;&amp; columns.length &gt; 1) { internalpath = internalpath.concat(columns[1] + "n"); } } } } catch(Exception e) { e.printStackTrace(); } System.out.println("Path of sd card external............"+externalpath); System.out.println("Path of internal memory............"+internalpath); } </code></pre> <p>Now you can use the path os external storage to create a folder.</p> <pre><code>if(android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED))//check if sd card is mounted { Dir=new File(externalpath,"your folder name"); if(!Dir.exists())// if directory is not here Dir.mkdirs() // make directory } </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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