I am developing a music player application and querying for the album names through the following code :
Cursor mediacur = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, null);
mediacur.moveToFirst();
do{
albumindex = mediacur.getColumnIndex(MediaStore.Audio.Media.ALBUM);
albumname = mediacur.getString(albumindex);
songs.add(albumname);
}while(mediacur.moveToNext());
I am getting all the album names along with Ringtones and Notifications too. How can I exclude the ringtones and notifications from my list?
Add a selection to your managed query call.
String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";
Cursor mediacur = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, selection, null, null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With