WEB开发网
开发学院手机开发Android 开发 Android 数据库与MapView总结 阅读

Android 数据库与MapView总结

 2010-11-05 00:54:34 来源:WEB开发网   
核心提示:{String where = "f_id=?";String[] whereValue ={allRestaurantID.get(intItemSelected)};int intCol = dbHelper.delete(tables[0], where, whereValue);/* 返回删

{

String where = "f_id=?";

String[] whereValue =

{

allRestaurantID.get(intItemSelected)

};

int intCol = dbHelper.delete

(

tables[0], where, whereValue

);

/* 返回删除成功笔数 >0时 */

if(intCol>0)

{

/* 删除成功 */

updateListView();

}

}

break;

}

}

};

/**

* 更新ListView数据

*/

private void updateListView()

{

String f[] = { "f_id", "f_name", "f_address", "f_cal"};

/* SELECT f[] FROM tables[0] */

Cursor c = dbHelper.select

(

tables[0], f, "", null, null, null, null

);

lstRestaurant = new ArrayList();

allRestaurantID = new ArrayList();

allRestaurantName = new ArrayList();

allRestaurantAddress = new ArrayList();

allRestaurantCal = new ArrayList();

while (c.moveToNext())

{

lstRestaurant.add

(

c.getString(1)+"("+c.getString(3)+

getResources().getText(R.string.str_cal)+")"

);

allRestaurantID.add(c.getString(0));

allRestaurantName.add(c.getString(1));

allRestaurantAddress.add(c.getString(2));

allRestaurantCal.add(c.getString(3));

}

if(lstRestaurant.size()>0)

{

ArrayAdapter adapter = new ArrayAdapter

(

EX10_06_03.this,

R.layout.simple_list_item_single_choice, lstRestaurant

);

mListView01.setItemsCanFocus(true);

mListView01.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

mListView01.setAdapter(adapter);

}

else

{

/* 数据库无记录,将flag设置为-1 */

上一页  12 13 14 15 16 17 18 19 20 21 22  下一页

Tags:Android 数据库 MapView

编辑录入:coldstar [复制链接] [打 印]
赞助商链接