How to get songs from an album in Android?

I get all the details of the album. Now I want to get all the songs from any album. How to request songs in a specific album?

I used this code to get information about the album:

Cursor cursor = contentResolver.query(
                MediaStore.Audio.Albums.getContentUri("external"),
                new String[] { 
                    MediaStore.Audio.Albums.ARTIST, 
                    MediaStore.Audio.Albums._ID,
                    MediaStore.Audio.Albums.NUMBER_OF_SONGS, 
                    MediaStore.Audio.Albums.ALBUM}, null, null,
                MediaStore.Audio.Albums.ALBUM + " ASC");

Please help me.

thank

+3
source share
1 answer

You can write a simple sqlite query for the string "selection" on contentResolver.query using the property fields of MediaStore.Audio.Media. Please check my answer to How to get songs and other files from an album?

0
source

All Articles