开发学院手机开发Android 开发 Android 小项目之SQLite 使用法门 阅读

Android 小项目之SQLite 使用法门

 2010-06-13 15:25:00 来源:WEB开发网   
核心提示:protected final static int MENU_EDIT=Menu.FIRST+1;protected final static int MENU_DELETE=Menu.FIRST+2;@Overridepublic boolean onCreateOptionsMenu(Menu menu) {//

protected final static int MENU_EDIT=Menu.FIRST+1;

protected final static int MENU_DELETE=Menu.FIRST+2;

@Override

public boolean onCreateOptionsMenu(Menu menu) {

// TODO Auto-generated method stub

super.onCreateOptionsMenu(menu);

menu.add(Menu.NONE, MENU_ADD, 0, R.string.ADD);

menu.add(Menu.NONE, MENU_EDIT, 0,R.string.EDIT);

menu.add(Menu.NONE, MENU_DELETE, 0,R.string.DELETE);

return true;

}

@Override

public boolean onOptionsItemSelected(MenuItem item) {

// TODO Auto-generated method stub

super.onOptionsItemSelected(item);

switch (item.getItemId()) {

case MENU_ADD:

operation("add");

break;

case MENU_EDIT:

operation("edit");

break;

case MENU_DELETE:

operation("delete");

break;

default:

break;

}

return true;

}

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

myEditText=(EditText)findViewById(R.id.EditText1);

myListView=(ListView)findViewById(R.id.ListView1);

db=new dbHelper(testDbActivity.this);

myCursor=db.select();

SimpleCursorAdapter adpater=new SimpleCursorAdapter(this

, R.layout.test, myCursor,

new String[]{dbHelper.FIELD_TITLE},

new int[]{R.id.topTextView});

myListView.setAdapter(adpater);

myListView.setOnItemClickListener(new OnItemClickListener() {

@Override

public void onItemClick(AdapterView arg0, View arg1, int arg2,

long arg3) {

// TODO Auto-generated method stub

上一页  1 2 3 4 5 6 7  下一页

Tags:Android 项目 SQLite

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接