在android Mediastore中查询sdcard中歌曲的艺术家名称。如果我们点击艺术家,它将显示特定艺术家的所有歌曲。我试过这样,但它会提前显示sdcard.thanks中的所有歌曲。
private void music_grid(int ch) {
System.gc();
String[] musicproj ={MediaStore.Audio.Artists._ID,
MediaStore.Audio.Artists.ARTIST,
MediaStore.Audio.Artists.NUMBER_OF_ALBUMS,
MediaStore.Audio.Artists.NUMBER_OF_TRACKS}
final String sortOrder = ArtistColumns.ARTIST
+ " COLLATE LOCALIZED ASC";
Uri uri = MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI;
musiccursor = getBaseContext().getContentResolver().query(uri,
musicproj, null, null, null);
count = musiccursor.getCount();
gridmusic = (GridView) findViewById(R.id.gridmusic);
Madapter = new MusicAdapter(getApplicationContext());
gridmusic.setAdapter(Madapter);
gridmusic.setOnItemClickListener(musicgridlistener1);
}