Android 数据库与MapView总结
2010-11-05 00:54:34 来源:WEB开发网&& mEditText03.getText().toString().trim().length() != 0) {
String f[] = { "f_id", "f_name" };
String[] selectionArgs = { mEditText01.getText().toString() };
Cursor c = dbHelper.select(tables[0], f, "f_name=?",
selectionArgs, null, null, null);
String strRes = "";
while (c.moveToNext()) {
strRes += c.getString(0) + " ";
}
if (strRes == "") {
String f2[] = { "f_name", "f_address", "f_cal" };
String v[] = { mEditText01.getText().toString().trim(),
mEditText02.getText().toString().trim(),
mEditText03.getText().toString().trim()
};
long rowid = dbHelper.insert(tables[0], f2, v);
strRes += rowid + " ";
} else {
}
if (dbHelper != null
&& dbHelper.getReadableDatabase().isOpen()) {
dbHelper.close();
}
Intent intent = new Intent();
intent.setClass(EX10_06_02.this, EX10_06_03.class);
startActivity(intent);
finish();
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
int idGroup1 = 0;
int orderItem2 = Menu.NONE + 1;
int orderItem3 = Menu.NONE + 2;
menu.add(idGroup1, MENU_EDIT, orderItem2, R.string.str_manu2).setIcon(
android.R.drawable.ic_dialog_info);
menu.add(idGroup1, MENU_DRAW, orderItem3, R.string.str_manu3).setIcon(
R.drawable.hipposmall);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent=new Intent();
switch (item.getItemId()) {
case (MENU_EDIT):
if(dbHelper!=null&&dbHelper.getReadableDatabase().isOpen()){
更多精彩
赞助商链接