Info

• ContentValues initialValues new Content'ValuesOin ContentValues

• initialValues.put (KEY TITLE, title) initialValues H\ttlo

• mDb.insert (DATABASE TABLE, null, initialValues) iSfiJftjSfffiA Jjji, (ill^Mi

if ffilfJtk^XHJ Content Values WiA^liLili'J, It^ft^to KW/Jn:

public boolean updateDiary(long rowld, String Li Lie, String body) { ContentValues args = new ContentValues(); args.put(KEY TITLE, title); args.put(KEY BODY, body);

Calendar calendar = Calendar.get Instance(); String created - calendar.get(Calendar.YEAR) ► 4- calendar, get (Calendar .MONTH) + "B" » calendar.get(Calendar.DAY OF MONTH) + "0" + calendar, get (Calendar .HOUR OF DAY) f "Btf" + calendar.get (Calendar. MINUTE) + args.put(KEY CREATED, created);

return rr.Db. update (DATABASE_ TABLE, args, KEY_ROWID + " = " + rowld, null) > 0; )

JI/Hj&fel^Jftl^M K^rfll. Mimi Activity & Activity Main,»

«¿«■«if]» 7 MM menu fi<J-¥-'>J, menu liiftiHWitfliaW^flBift'fr: onMenultem

Selected«ftV., KttttRiai public boolean onMenuItemSelected(int featureld, Menu Item item) (

switch (item.getItemId()) (

case INSERT ID:

createDiary();

return true;

case DELETEID:

mDbHelper.deleteDiary(getListView().getSeiectedltemld()); renderListView(); return true; )

return super.onMenuItemSelected(featureld, item); )

• ftnSt ^Si^Jta-iSSf E1 ifificiW^£tMf£lj createDiaryOiSKUo

• ftU^^-.lrW^ tf mDbHelper.deleteDiary(getListView().getSelectedhemld())i§

• renderList View( )iftfij Mff *t ft fij WJ if. /!•: createDiaryOaftSiiWitWSP T'/fr^':

private void createDiary() (

Intent i new Intent (this, ActivityDiaryEdit.class); startActivityForResult(i, ACTIVITY_CREATE); )

• flifeftlifi f intent, iil^ intent Activity Diary Edit 1,

0 0

Post a comment