1

I want to add validation of the save button i.e., check if edit text or recorded audio (one among these two) has been entered by the user or not if both are not entered then the user gets notified that either enter text or record your audio. I have done this code, but it's getting crashed onClick of save button


File fileName = new File(finalpath);
Log.e("FileName::",""+fileName);
//   convertfiletobase64(strreminder_txt, strreminder_time, finalpath, finalStrcheckDialy);
if (listfiles.size()==0) {
    listfiles.add(fileName);
} else {
    if (notifiadapeterpos < listfiles.size()) {
        listfiles.set(notifiadapeterpos, fileName);
    } else {
        listfiles.add(fileName);
    }
}
notificationPart = prepareFilePart1(listfiles);

if(mediaRecorder==null&&mediaPlayer==null){
    if (strreminder_txt.isEmpty()){
        Toast.makeText(RegisterMember.this, "Please enter Reminder Text or Record your Reminder!", Toast.LENGTH_SHORT).show();
    }else {
        if (btnsaveReminder.getText().equals("Update")){
            updateReminder(strreminder_txt, strreminder_time, fileName, finalStrcheckDialy,notificationPart);
        }else {
            saveReminder(strreminder_txt, strreminder_time, fileName, finalStrcheckDialy,notificationPart);
        }
    }
}

How to resolve this?

Keyvan Soleimani
  • 606
  • 2
  • 4
  • 16

0 Answers0