其實非常簡單,只要把cursor填到simpleCursorAdapter構造方法中去就行了.
Cursor c = mResolver.query(CityProvider.URI_CITY, null,
table.city.PROVICE + "=?", new String[] { which + 1 + "" },
table.city.ID + " ASC");
ListAdapter adapter = new SimpleCursorAdapter(mContext,
android.R.layout.simple_list_item_1, c,
new String[] { table.city.NAME },
new int[] { android.R.id.text1 });
new AlertDialog.Builder(mContext).setTitle(R.string.select_city)
.setAdapter(adapter, mCityClickListener).show();
使用SimpleCursorAdapter
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.