Searching For Music Files With Mediastore
I have been researching this for hours now. I've looked at android javadoc - MediaStore and I just don't get it. I've looked for examples. Nothing. I want to search the music libra
Solution 1:
The MediaStore
more or less is an sqlite DB. There are many ways to query it. By album, by artist, by playlist, by song, and so on. This will return a Cursor
of all songs, for example.
Cursorcursor= getContentResolver().query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
null,
null,
null,
MediaStore.Audio.Media.TITLE + " ASC");
You can then get specific columns from it like so:
while (cursor.moveToNext()) {
Stringtitle= cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TITLE));
// Whatever else you need
}
Post a Comment for "Searching For Music Files With Mediastore"