0
首先,我應該說我是Android編程新手...... 我正在檢索手機中的所有歌曲,並使用LoadManager和BindView在ListView中顯示以顯示數據。但是我無法在我的ImageView中顯示ALBUM_ART。從歌曲獲取ALBUM_ART
這正是我需要的...
,但我不知道如何實現它。
我從我想loadermanager
@Override
public void bindView(View view, Context contex, Cursor cursor) {
TextView songText = (TextView) view.getTag(R.id.txt_title);
TextView artistText = (TextView) view.getTag(R.id.txt_artist);
ImageView albumImg = (ImageView) view.getTag(R.id.img_album);
albumId = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID));
和我之外的其他LoaderManager我bindView內部調用來檢索album_art
public class AlbumListItem implements LoaderManager.LoaderCallbacks<Cursor> {
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
String[] projection = {
MediaStore.Audio.Albums._ID,
MediaStore.Audio.Albums.ALBUM_ART,
};
return new CursorLoader(MainActivity.this, MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, projection
, MediaStore.Audio.Albums.ALBUM_ID + " = ?", new String[]{albumId}, null);
}
@Override
public void onLoadFinished(Loader<Cursor> arg0, Cursor arg1) {
// TODO Auto-generated method stub
}
@Override
public void onLoaderReset(Loader<Cursor> arg0) {
// TODO Auto-generated method stub
}
}
但正如我說我不歌曲BindView知道如何(或在哪裏)插入或初始化AlbumListItem loader getLoaderManager()。initLoader(ID,null,MainActivity.this);
謝謝!