title: Get all external mounted devices (USB, SD Card)
body: <p>I am already looking several days for a clear answer, but I am still not satisfying with the solutions which I have found. So I am asking once more on stackoverflow:</p>
  
  <p><strong>Is there any efficient way to get all mounted external storage on an Android device</strong>? 
  I know that managing external storage always depends on the producer of the device. But I don't wonna publish my app and wait for incoming "bugs".</p>
  
  <p>So I have produced my code on "trial and error" based on two different devices (Samsung and Acer). </p>
  
  <p>The code in attach makes the best outcome for my needs (but still not perfect, because the Acer device has the SD card shown in both "mnt" and "storage" and further more with different names). </p>
  
  <p>As I know that this code is not a professional way to manage that, please help me with better solutions. </p>
  
  <pre><code> public static List&lt;StorageInfo&gt; getStorageList() {
      List&lt;StorageInfo&gt; list = new ArrayList&lt;&gt;();
      List&lt;File&gt; typicallFolders = new ArrayList&lt;&gt;();
      typicallFolders.add(new File("/storage"));
      typicallFolders.add(new File("/mnt"));
      int internalNumber = 1;
      HashSet&lt;String&gt; knownPaths = new HashSet&lt;&gt;();
      for(File fs:typicallFolders) {
          try {
              if(!fs.exists())
                  continue;
              for (File f : fs.listFiles()) {
                  File finalPath = getexternalStorage(f, 1);
                  if (finalPath != null &amp;&amp; !knownPaths.contains(finalPath.toString()) &amp;&amp; finalPath.canWrite()) {
                      list.add(new StorageInfo(finalPath.toString(), true, true, internalNumber++));
                      knownPaths.add(finalPath.toString());
                  }
              }
  
          } catch (Exception e) {
              //Catch exception if any
              e.printStackTrace();
          }
      }
      return list;
  }
  
  private static File getexternalStorage(File path,int depth){
      if(Environment.isExternalStorageRemovable(path))
          return path;
      File[] subFolders = path.listFiles();
      if(depth == 3 || subFolders.length != 1){
          return null;
      }
       return getexternalStorage(subFolders[0],depth++);
  }
  </code></pre>