title: How do I get the folder name from a String containing the Absolute file path in android?
body: <p>Path name is : <code>/storage/emulated/0/Xender/video/MyVideo.mp4</code></p>
  
  <p>I am able to get last file name [MyVideo.mp4] from path using </p>
  
  <pre><code>String path="/storage/emulated/0/Xender/video/MyVideo.mp4";
  String filename=path.substring(path.lastIndexOf("/")+1);
  </code></pre>
  
  <p><a href="https://stackoverflow.com/a/26570321/5035015">https://stackoverflow.com/a/26570321/5035015</a></p>
  
  <p>Now i want to extract path [/storage/emulated/0/Xender/video] from this path.</p>
  
  <p>I have one use of this path in my code so that i want to do this like this.</p>
  
  <p>How can i do this?</p>
  
  <p>Any help will be appreciated.</p>