/* * loads content from storage */ private void loadContent() { Note note = controller.get(noteID); title.setText(note.getTitle()); currentDate = note.getDate(); displayDate(); location.setText(note.getLocation()); content.setText(note.getNoteContent()); }
/* * save note to the database */ protected void saveNote() { Note note = new Note(); note.setLocation(location.getText().toString()); note.setDate(currentDate); note.setTitle(title.getText().toString()); note.setNoteContent(content.getText().toString()); if (isEdit) { note.setId(noteID); controller.modify(noteID, note); Toast.makeText(getBaseContext(), "Note Modified !", Toast.LENGTH_LONG).show(); finish(); } else { note.setId(0); long s = controller.save(note); Toast.makeText(getBaseContext(), "Note Saved !", Toast.LENGTH_LONG).show(); finish(); } }