samedi 18 août 2018

if/ else if not working?

I would like to build URL depending on Strings choSection and choType so I did some if else statement: 1/ if both string are empty return basic url

   Uri.Builder uriBuilder = baseUri.buildUpon();
            if(choSection.isEmpty()&& choType.isEmpty()) {
                return new NewsLoader(this,NEW``S_REQUEST_URL);       }

2/If only one is empty add only one parameter

else if (!choSection.isEmpty()&& choType.isEmpty())
     {uriBuilder.appendQueryParameter("section", choSection);}
            return new NewsLoader(this, uriBuilder.toString());

And it steems that the second condition where one string is empty is not working. What might be a reason?

Aucun commentaire:

Enregistrer un commentaire