我有一個查詢結果集,我喜歡先編輯,然後把它放到我的ListView。如果沒有第一編輯我的數據,我可以用SimpleCursorAdapter這樣的:多維數組到ListView ..怎麼樣?
ListAdapter adapter = new SimpleCursorAdapter(
this,
R.layout.list_item,
mCursor,
new String[] { "address", "city" },
new int[] { R.id.address, R.id.zip_city });
this.setListAdapter(adapter);
但現在,我把一切都放在一個多維數組這樣的:
if(mCursor.isFirst()) {
//create a new array
String[][] listData = new String[mCursor.getCount()][3];
int i = 0;
do {
listData[i] = new String[] {
mCursor.getString(mCursor.getColumnIndex("address")),
mCursor.getString(mCursor.getColumnIndex("zip")) + " " + mCursor.getString(mCursor.getColumnIndex("city")),
calculateDistance(Double.parseDouble(mCursor.getString(mCursor.getColumnIndex("diff"))))
};
i++;
} while(mCursor.moveToNext());
}
所以我的問題是現在,我也沒辦法如何把這個給我的ListView。有人可以幫我嗎?對不起,我的英語和Java知識不好。 :)