@Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); memos = new MemoDBHelper(this); SQLiteDatabase db = memos.getWritableDatabase(); Cursor cursor = db.query("memoDB", cols, "_ID=" + String.valueOf(id), null, null, null, null); startManagingCursor(cursor); int idx = cursor.getColumnIndex("memo"); cursor.moveToFirst(); Intent i = new Intent(); i.putExtra("text", cursor.getString(idx)); setResult(RESULT_OK, i); memos.close(); finish(); }
public Cursor getMemos() { this.memos = new MemoDBHelper(this); SQLiteDatabase db = memos.getReadableDatabase(); Cursor cursor = db.query("memoDB", MemoList.cols, null, null, null, null, null); this.startManagingCursor(cursor); return cursor; }
private Cursor getMemos() { memos = new MemoDBHelper(this); SQLiteDatabase db = memos.getReadableDatabase(); Cursor cursor = db.query("memoDB", cols, null, null, null, null, null); startManagingCursor(cursor); return cursor; }
private void showMemos(Cursor cursor) { if (cursor != null) { String[] from = {"title"}; int[] to = {android.R.id.text1}; SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, cursor, from, to); setListAdapter(adapter); } memos.close(); }