samedi 23 mars 2019

IF working incorrect, or I did something wrong?

My Scenario is following:

  1. User open application, with profile class
  2. At this point userDTO.getMobile - is empty AND artistDetails.getName - is empty too
  3. When user fills up his profile, then userDTO.getMobile still EMPTY, AND artistDetails.getName NOT empty

I need to make the following:

  1. if getMobile AND getName are empty display HELLO
  2. if getMobile, BUT getName is NOT empty display GOODBYE

I have right now, the following:

if (userDTO.getMobile().isEmpty() && artistDetailsDTO.getName().isEmpty()) {
        ProjectUtils.showToast(getActivity(), "HELLO");
    } else if (artistDetailsDTO.getName().matches("[a-zA-Z]+")) {
        ProjectUtils.showToast(getActivity(), "GOODBYE");
    }

But, in anycase I'm displaying HELLO in casy, cannot understand Why..

I fill up profile, so I expecting, that

  • username.getMobile.isEmpty
  • artistDetails.userName.matches...
  • So, I must show - GOOD BYE.

Can You assist me, please?

Thank you

Aucun commentaire:

Enregistrer un commentaire