+ Reply to Thread
Results 1 to 2 of 2

Thread: store all music in list

  1. #1

    store all music in list

    I want to search for music files that are on my media store DB and store them in list
    with all music details like artist , song name , etc....

  2. #2
    Junior Member
    Join Date
    May 2012
    Posts
    14
    Here you are
    Code:
    String MEDIASTORE = MediaStore.Audio.Media.IS_MUSIC + " != 0";
    
    String[] DB = {
            MediaStore.Audio.Media._ID,
            MediaStore.Audio.Media.ARTIST,
            MediaStore.Audio.Media.TITLE,
            MediaStore.Audio.Media.DATA,
            MediaStore.Audio.Media.DISPLAY_NAME,
            MediaStore.Audio.Media.DURATION
    };
    
    cursor = this.managedQuery(
            MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
            DB,
            MEDIASTORE,
            null,
            null);
    
    private List<String> songs = new ArrayList<String>();
    while(cursor.moveToNext()){
            // add records to your song list using [cursor.getString(1 or 2 or 3 and so on...);]
    }

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts