Searching Audio Files in Android

Public on January 7, 2009
Searching for Audio Files in Android is so much similar in Display Contact Names in Android (I suggest you to look back at the explanation for a more detailed explanation). The audio formats that Android allows are MP3, AAC, AMR.
public class Main extends ListActivity {
  private Cursor audioCursor;
  public void onCreate(Bundle savedInstanceState) {

    audioCursor = this.managedQuery(Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, null);

    String[] columnsToMap = new String[] {Audio.Media.TITLE , Audio.Media._ID};
    int[] mapTo = new int[] {,};

    ListAdapter mAdapter = new SimpleCursorAdapter(this, android.R.layout.two_line_list_item , audioCursor, columnsToMap, mapTo);

Quick Explanation
The thing that you need here is Audio.Media.EXTERNAL_CONTENT_URI, as stated on the the contact display article, managedQuery acts like a sql call and the table this time is Audio.Media.EXTERNAL_CONTENT_URI.
Another thing you might have notice is String[] columnsToMap = new String[] {Audio.Media.TITLE , Audio.Media._ID};. These and a lot more are the columns that can be used.

Source Code file for Searching Audio in Android

Display Contact Names in Android

Update History
   Jan 17, 2012 - Visual Update

[Advertising]Faster Thinking - Speed up your brain

Faster Thinking Game

sentiment_satisfied Emoticon