title: How to get all the audio file using mediastore
body: <p>I am trying to get all the media files from the device (Internal and SDcard).Till now I am able to get all the media files from a fixed folder of SD Card .I have gone through most of the web pages on mediastore .And i am able to get the media info.But how can I get all the audio files from the device any example  will be helpful.
  I tried this way ` public class SongDto {</p>
  
  <pre><code>public long songId;
  public String songTitle;
  public String songArtist;
  public String path;
  public short genre;
  public long duration;
  public String album;
  public Bitmap albumArt;
  
  public String toString() {
  return String.format("songId: %d, Title: %s, Artist: %s, Path: %s, Genere: %d, Duration %s",
          songId, songTitle, songArtist, path, genre, duration);
  }
  </code></pre>
  
  <p>and getting these value in another class name</p>
  
  <pre><code>public class Utils {
  private Context _context;
  
  // constructor
  public Utils(Context context) {
      this._context = context;
  }
  public static ArrayList&lt;SongDto&gt; getMusicInfos(Context context) {
  
      ArrayList&lt;SongDto&gt; musicInfos = new ArrayList&lt;SongDto&gt;();
  </code></pre>
  
  <p>and now I am trying to get the the songTitle in another class</p>
  
  <pre><code>private ArrayList&lt;SongDto&gt; musicInfos;
  private Utils utils;
  private ArrayList&lt;String&gt; songPaths = new ArrayList&lt;String&gt;();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      utils = new Utils(this);
      songPaths = utils. getMusicInfos(songTitle);
  }
  
  private void update(){
      ArrayAdapter&lt;String&gt; list=new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1,musicInfos.add(songTitle) );
  }
  }
  </code></pre>
  
  <p>How I can get only the desired array like array of songId ,songArtist,song duration.And where I am doing wrong .How to set the getMusicInfos method
  `</p>