private void update(int type, String contents, Date reminderDate) {
   realm.beginTransaction();
   addMemo.setContents(contents);
   addMemo.setReminderDate(reminderDate);
   if (type == 1) {
     addMemo.setHasPhoto(true);
   } else if (type == 2) {
     addMemo.setHasVoice(true);
   }
   realm.copyToRealm(addMemo);
   realm.commitTransaction();
 }
 private void save(int type, String contents, Date reminderDate) {
   realm.beginTransaction();
   addMemo = new Memo();
   addMemo.setId(getMemoId());
   addMemo.setContents(contents);
   addMemo.setReminderDate(reminderDate);
   addMemo.setRepeat(((SpinnerItem) repeat.getSelectedItem()).getKey());
   addMemo.setCreateTime(new Date());
   addMemo.setCreateUser(ConstUtils.USER_NAME);
   if (type == 1) {
     addMemo.setHasPhoto(true);
   } else if (type == 2) {
     addMemo.setHasVoice(true);
   }
   realm.copyToRealm(addMemo);
   realm.commitTransaction();
 }