mardi 25 août 2015

Properly doing an If Else using a string as the decider

I'm trying to automate an if else section of my code so that a button press prior to these actions dictates what will happen later on currently I have this button at the start of my app doing this

.putExtra(PlayerActivity.Tourtype, "Welsh");

when it starts an intent I have Tourtype in my Playeractivity at the start as

public static final String Tourtype = "xx";

and then I am trying to do this which isn't working

if (responseString.equals("Home")) {
  releasePlayer();
  if (Tourtype.equals("English")) {
    contentUri = (Uri.parse("randomurl"));}
  else if (Tourtype.equals("Welsh")) {
    contentUri = (Uri.parse("randomurl"));
}

Am I going about this the right way, am I missing something out? Thanks for any and all help!

Aucun commentaire:

Enregistrer un commentaire