title: List all music in MediaStore with the PATHs
body: <p>Ok so I've been working on this project for a few days now and most of my time has been working out how to list all the music on a device in a LIST VIEW or something else, I have searched for a few days now and this is killing me. I did get so close at one point with all the music in one folder showing, though since most people will have sub folders for things like artiest and albums I need a way to search sub folders for MP3s or music files.</p>
  
  <p>Here is what I have so far for Music collection: </p>
  
  <pre><code>package com.androidhive.musicplayer;
  
  import java.io.File;
  import java.io.FilenameFilter;
  import java.util.ArrayList;
  import java.util.HashMap;
  
  import android.provider.MediaStore;
  
  public class SongsManager {
  // SDCard Path
  final String MEDIA_PATH = new String(MediaStore.Audio.Media.getContentUri("external").toString());
  private ArrayList&lt;HashMap&lt;String, String&gt;&gt; songsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
  // Constructor
  public SongsManager(){
  
  }
  
  /**
   * Function to read all mp3 files from sdcard
   * and store the details in ArrayList
   * */
  public ArrayList&lt;HashMap&lt;String, String&gt;&gt; getPlayList(){
      File home = new File(MEDIA_PATH);
  
      if (home.listFiles(new FileExtensionFilter()).length &gt; 0) {
          for (File file : home.listFiles(new FileExtensionFilter())) {
              HashMap&lt;String, String&gt; song = new HashMap&lt;String, String&gt;();
              song.put("songTitle", file.getName().substring(0, (file.getName().length() - 4)));
              song.put("songPath", file.getPath());
  
              // Adding each song to SongList
              songsList.add(song);
          }
      }
      // return songs list array
      return songsList;
  }
  
  /**
   * Class to filter files which are having .mp3 extension
   * */
  class FileExtensionFilter implements FilenameFilter {
      public boolean accept(File dir, String name) {
          return (name.endsWith(".mp3") || name.endsWith(".MP3"));
      }
  }
  
  }
  </code></pre>
  
  <p>Thanks to anyone who can help. :)</p>