Exemplo n.º 1
0
 @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();
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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();
 }