SQLite的小例子--备忘录(11)
来源:未知 责任编辑:责任编辑 发表时间:2014-01-20 07:51 点击:次
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
mDbHelper = new MyAdapter(this);
mDbHelper.open();
setContentView(R.layout.test_edit);
mCategory = (Spinner) findViewById(R.id.category);
mTitleText = (EditText) findViewById(R.id.todo_edit_summary);
mBodyText = (EditText) findViewById(R.id.todo_edit_description);
Button confirmButton = (Button) findViewById(R.id.todo_edit_button);
mRowId = null;
Bundle extras = getIntent().getExtras();
mRowId = (bundle == null) ? null : (Long) bundle
.getSerializable(MyAdapter.KEY_ROWID);
if (extras != null) {
mRowId = extras.getLong(MyAdapter.KEY_ROWID);
}
populateFields();
confirmButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
setResult(RESULT_OK);
finish();
}
});
}
private void populateFields() {
if (mRowId != null) {
Cursor todo = mDbHelper.fetchTest(mRowId);
startManagingCursor(todo);
String category = todo.getString(todo
.getColumnIndexOrThrow(MyAdapter.KEY_CATEGORY));
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>