Android 数据库与MapView总结
2010-11-05 00:54:34 来源:WEB开发网dbHelper.close();
}
super.onDestroy();
}
}
package irdc.ex10_06;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class EX10_06_02 extends Activity {
private EditText mEditText01, mEditText02, mEditText03;
private Button mButton01;
static final private int MENU_EDIT = Menu.FIRST + 1;
static final private int MENU_DRAW = Menu.FIRST + 2;
private MySQLiteOpenHelper dbHelper = null;
int version = 1;
String tables[] = { "t_restaurant" };
String fieldNames[][] = { { "f_id", "f_name", "f_address", "f_cal" } };
String fieldTypes[][] = { { "INTEGER PRIMARY KEY AUTOINCREMENT", "text",
"text", "text" } };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_add);
mEditText01 = (EditText) findViewById(R.id.myEditText1);
mEditText02 = (EditText) findViewById(R.id.myEditText2);
mEditText03 = (EditText) findViewById(R.id.myEditText3);
dbHelper = new MySQLiteOpenHelper(this, "mydb", null, version, tables,
fieldNames, fieldTypes);
mButton01 = (Button) findViewById(R.id.myButton1);
mButton01.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
if (mEditText01.getText().toString().trim().length() != 0
&& mEditText02.getText().toString().trim().length() != 0
更多精彩
赞助商链接