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

Android 数据库与MapView总结

 2010-11-05 00:54:34 来源:WEB开发网   
核心提示:import android.widget.ListView;/* 编辑餐厅数据Activity */public class EX10_06_03 extends Activity{private ListView mListView01;static final private int MENU_ADD = Men

import android.widget.ListView;

/* 编辑餐厅数据Activity */

public class EX10_06_03 extends Activity

{

private ListView mListView01;

static final private int MENU_ADD = Menu.FIRST;

static final private int MENU_DRAW = Menu.FIRST+2;

private MySQLiteOpenHelper dbHelper=null;

/* version必须大于等于1 */

private int version = 1;

private List allRestaurantID;

private List allRestaurantName;

private List allRestaurantAddress;

private List allRestaurantCal;

private List lstRestaurant;

private int intItemSelected=-1;

/* 数据库数据表 */

private String tables[] = { "t_restaurant" };

/* 数据库字段名称 */

private String fieldNames[][] =

{

{ "f_id", "f_name", "f_address", "f_cal" }

};

/* 数据库字段数据类型 */

private String fieldTypes[][] =

{

{ "INTEGER PRIMARY KEY AUTOINCREMENT", "text" , "text", "text"}

};

@Override

protected void onCreate(Bundle savedInstanceState)

{

// TODO Auto-generated method stub

super.onCreate(savedInstanceState);

setContentView(R.layout.layout_list);

mListView01 = (ListView)findViewById(R.id.myListView1);

dbHelper = new MySQLiteOpenHelper

(this, "mydb", null, version, tables, fieldNames, fieldTypes);

updateListView();

mListView01.setOnItemClickListener

(new ListView.OnItemClickListener()

{

public void onItemClick

(AdapterView parent, View v, int id, long arg3)

{

// TODO Auto-generated method stub

/* f_id字段 */

intItemSelected = id;

/* 弹出的菜单提供两种功能(编辑、删除) */

String[] dlgMenu=

上一页  4 5 6 7 8 9 10 11 12 13 14  下一页

Tags:Android 数据库 MapView

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