title: Android Open External Storage directory(sdcard) for storing file
body: <p>I want to open external storage directory path for saving file programatically.I tried but not getting sdcard path.
  How can i do this?is there any solution for this??</p>
  
  <pre><code>private File path = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>private File path = new File(Environment.getExternalStorageDirectory() + "");
  </code></pre>
  
  <p>I tried getting path from above both methods but both are pointing internal memory.</p>
  
  <p>When we open storage memory if sdcard is peresent it will shows like below-
  <img src="https://i.stack.imgur.com/4iFiK.png" alt="enter image description here"></p>
  
  <p>device storage &amp; sd memory card.</p>
  
  <p>I want to get sd memory path through coding.
  I have given permissions in manifest-</p>
  
  <pre><code>    &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  </code></pre>