所以,我終於能夠完成這個工作我自己......
我不得不寫延伸的CursorAdapter我不得不指派我所有的文本,我從有了新的方法......
有我數據庫與TextView。所以,我也可以給我的圖像裝載機的鏈接(緩存)圖像加載...
這是我的代碼:
private static final class MyCursorAdapter extends CursorAdapter {
MyCursorAdapter(Context context, Cursor cursor, int flags) {
super(context, cursor, flags);
mInflater = LayoutInflater.from(context);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View v = mInflater.inflate(R.layout.row_twitter, parent, false);
return v;
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
TextView listtitle = (TextView) view.findViewById(R.id.listtitle);
TextView listusername = (TextView) view.findViewById(R.id.listusername);
TextView listdate = (TextView) view.findViewById(R.id.listdate);
listtitle.setText(cursor.getString(cursor.getColumnIndex(DataDBAdapter.KEY_TWITTER_TWEET)));
listusername.setText(cursor.getString(cursor.getColumnIndex(DataDBAdapter.KEY_TWITTER_USERNAME)));
listdate.setText(cursor.getString(cursor.getColumnIndex(DataDBAdapter.KEY_TWITTER_DATE)));
listtitle.setTextColor(Color.GRAY);
listdate.setTextColor(Color.GRAY);
ImageView iv = (ImageView) view.findViewById(R.id.image);
imageLoader.displayImage(cursor.getString(cursor.getColumnIndex(DataDBAdapter.KEY_TWITTER_IMAGEURL)),
iv, options);
}
LayoutInflater mInflater;
}
這實際上工作得很好:)