SQLite的小例子--备忘录(10)
来源:未知 责任编辑:责任编辑 发表时间:2014-01-20 07:51 点击:次
String[] from = new String[] { MyAdapter.KEY_SUMMARY };
int[] to = new int[] { R.id.label };
//现在创建一个数组适配器并且设置它现在在我们的列中
SimpleCursorAdapter notes = new SimpleCursorAdapter(this,
R.layout.test_row, cursor, from, to);
setListAdapter(notes);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
menu.add(0, DELETE_ID, 0, R.string.menu_delete);
}
@Override
protected void onDestroy() {
super.onDestroy();
if (dbHelper != null) {
dbHelper.close();
}
}
}
TestDetails.java
Java代码
package com.loulijun.sqlitetest;
import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
public class TestDetails extends Activity {
private EditText mTitleText;
private EditText mBodyText;
private Long mRowId;
private MyAdapter mDbHelper;
private Spinner mCategory;
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>