Search code examples
androidmp3

Android: How to get meta data of a particular mp3 song


I know that the songs artist,album etc can be displayed by using MediaStore.Audio class. But it displays the list of artists,albums etc. The problem is when I click an artist name(displayed as list in my activity), all the songs with that particular artist should be displayed.

How can I filter the songs based on meta data (album/artist etc). How to get metadata of that particular song ?


Solution

  • If you want to filter based on the artist that the user clicked, you need to requery the database.

    Below is an example of such a query.

    String query = MediaStore.Audio.Media.IS_MUSIC + " != 0 AND _display_name LIKE '%.mp3' AND artist LIKE " + artistStringHere;