/** init doitem 的部分数据 */ private void initDoItem(int index) { if (index == -1) return; noteGlobal = (NoteGlobal) ModifyDoItem_Activity.this.getApplication(); doItem = noteGlobal.doList.get(index); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(doItem.getBeginTime()); beginTimeTextView.setText( calendar.get(Calendar.HOUR_OF_DAY) + ":" + calendar.get(Calendar.MINUTE)); tagtTextView.setText(doItem.getBigTag() + "-" + doItem.getLitleTag()); contentEditText.setText(doItem.getContent()); }
@Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.do_btn_save: doItem.setBigTag(tagtTextView.getText().toString().split("-")[0]); doItem.setLitleTag(tagtTextView.getText().toString().split("-")[1]); doItem.setBeginTime(doTemp.getBeginTime()); noteGlobal = (NoteGlobal) ModifyDoItem_Activity.this.getApplication(); doItem.setContent(contentEditText.getText().toString()); ContentValues values = new ContentValues(); values.put( PlanDbHelperContract.DoWhatTableInfo.COLUMN_NAME_BEGINTIME, doItem.getBeginTime()); values.put( PlanDbHelperContract.DoWhatTableInfo.COLUMN_NAME_BIGTAG, doItem.getBigTag()); values.put( PlanDbHelperContract.DoWhatTableInfo.COLUMN_NAME_LITTLETAG, doItem.getLitleTag()); values.put( PlanDbHelperContract.DoWhatTableInfo.COLUMN_NAME_CONTENT, doItem.getContent()); noteGlobal.UpdateDoItem(values, index, doItem.getDate()); Intent data = new Intent(); setResult(1, data); ModifyDoItem_Activity.this.finish(); break; case R.id.do_btn_giveup: ModifyDoItem_Activity.this.finish(); break; default: break; } }