mercredi 31 mai 2017

is there a way to shorten the following code into one if statement?

I have the following code:

if (!isFinishing()) {
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
         if (!isDestroyed()) {
              showScoreScreenFragment(chronoText);
         }
     } else {
          howScoreScreenFragment(chronoText);
     }
}

That I need write before I'm commiting fragment transactions. is there s way to make this test in one if statement instead of 3?

because this:

if (!isFinishing() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && !isDestroyed())

doesn't have the same meaning.

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire