1: DiaryDbAdapter DatabaseHelper SQLiteDatabase :
2
3
4
5
1 onMenuItemSelected MENU :
createDiary(); mDbHelper.deleteDiary(getListView().getSelectedItemId()) ;renderListView()
createDiary intent intent ActivityDiaryEdit intent
renderListView onCreate ListView ListView ListView renderListView()
mDiaryCursor = mDbHelper.getAllNotes(): Cursor
startManagingCursor(mDiaryCursor): Cursor Activity Cursor Cursor
String[] from: ListView
int[] to: SimpleAdapter View View TextView ImageView View id Android.R.id.text1
setListAdapter(notes): SimpleCursorAdapter ListActivity ListView
1:
mRowId null mDbHelper.createDiary(title, body) setResult(RESULT_OK, mIntent) example123 onActivityResult:
2 ListView onListItemClick :
c.moveToPosition(position): Cursor position position
Intent i = new Intent(this, ActivityDiaryEdit.class): ActivityDiaryEdit intent
putExtra(): intent
c.getString(c.getColumnIndexOrThrow(DiaryDbAdapter.KEY_TITLE)): title
c.getString(c.getColumnIndexOrThrow(DiaryDbAdapter.KEY_BODY)): body
startActivityForResult(i, ACTIVITY_EDIT): intent Activity
3 onCreate :
ActivityDiaryEdit Activity 2 intent
intent extras ;
intent extras
ActivityDiaryEdit extras null intent
Reviews
There are no reviews yet.