你好傢伙我在mItems.add()它面臨問題它需要參數int和集合類型。我給參數作爲int並傳遞一些字符串值。我不明白爲什麼有添加錯誤。列表中ListFragment錯誤添加方法
private List mItems; // ListView商品列表
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// initialize the items list
mItems = new ArrayList<ListViewItem>();
Resources resources = getResources();
DBHandler dbh = new DBHandler(getContext());
String friend_name, friend_status,friend_date_time,friend_fb_id;
String fb_url;
Cursor cursor = dbh.readAllFriends(dbh);
int a=0;
while(cursor.moveToNext()){
friend_name = cursor.getString(cursor.getColumnIndex(TableInfo.F_USER_NAME));
friend_status = cursor.getString(cursor.getColumnIndex(TableInfo.F_USER_STATUS));
friend_date_time = cursor.getString(cursor.getColumnIndex(TableInfo.F_DATE));
friend_fb_id = cursor.getString(cursor.getColumnIndex(TableInfo.F_FACEBOOK_ID));
fb_url="https://graph.facebook.com/"+friend_fb_id+"/picture?type=large";
mItems.add(a, fb_url,friend_name,friend_status,friend_date_time);
}
cursor.close();
在你的while循環中添加以下行 –