Info

MENU tit, ft!f^igff »ifiijOK 8-33 flr-i-A ActivityMain 4'#liTMfWiUI K#i>J<:

@Gverride public boolean onCreateGptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu);

menu.add(0, MENU_ITEM_INSERT, 0, R.string.menu insert);

return true; }

ft 8 id^Slt^JfKlUfMo

Klin* if K/i- ActivityDiaryEditor'I1, «I+efffflBtfJ.

f+iiiia^r^ukiaAiit^ifii, » idaAiitn

ActivityDiaryEditor fi'fH1 Ml R-J onCreate()$ ft, It ^W^lTifr

• -iiciiJ^^'i'- (menu) fjs/jll j' iflffl 8-33 ffi/K

^■iii-asiiun idficfli/saAjaiffl 8-34 r^-Mi

@Override protected void onCreate(Bundle savedlnstanceState) ( super.onCreate(savedInstanceState);

sotTheme(Android.R.style.ThemeBlack);

final Intent intent - getIntent();

final String action = intent.getAction();

setContentView(R.layout.diary edit);

mTitleText = (EditText) findview3yld(R.id.title);

rnBodyText = (EditText) tindViewById(R.id.body);

confirmButton (Button) findViewByld(R.id.confirm);

if (EDIT DIARYACTION.equals(action)) {//3*$iil3i£ rnState = STATEEDIT; mUri - intent.getData<);

mCursor = managcdQuery(mUr1, PROJECTION, null, null, null);

mCursor.moveToFirst();

String title mCursor.getString(1);

mTitleText.setTextKeepState(title);

String body = mCursor.getString(2);

rnBodyText.setTextKeepState(body);

setResult(RESULT OK, (new Intent ()). setAction (miJr i . toString ())) ;

setTitler^ROiti") ;

\ else if (INSERT DIARY ACTION, equals (action) ) {// Writ Bid mStäte = STATE INSERT; setTitie ("ffti^BiC"); ) else (

Log.e(TAG, "no such action error"); finish();

confirmButton.SetOnClickListener(new View.OnCiicklistener() {

public void onClick(View view) {

insertDiary();

0 0

Post a comment