I'm new at Android and I am having a problem with my code.
the software is not showing "Fail" when the user presses the wrong block.
When I debug the code, it is only running the if part, not the else. I want to execute the else condition as well, any suggestions?
private void buttonLogic(View v) {
List<Integer> tempList = new ArrayList<>();
for (int i = 0; 1 <= curLevel; i++) {
if(i!=12)
tempList.add(buttons.get(i));
else
break;
}
if (tempList.contains(v.getTag())) {
curGuess++;
checkWin();
} else {
lostGame();
}
}
private void lostGame () {
Toast.makeText(this, "Fail!", Toast.LENGTH_SHORT).show();
disableButtons();
b_new.setVisibility(View.VISIBLE);
}
Aucun commentaire:
Enregistrer un commentaire