samedi 5 décembre 2015

Lots of if statements

I want to make some kinda dictionary,But not exactly a dictionary,

I have two text views, One for the word, The other one for the meaning.

I have two Buttons which they change an integer's number

And finally I have lots of if, For Example:

(if i==1){

txt1.setText("x");

txt2.setText("y");

}

(if i==2){

txt1.setText("n");

txt2.setText("m");

}

Q1: Do I have to use that much if?

Q2: Where should I put those if? In each Button's ClickListener ?

Q3: Can you suggest a better way to do that?

Aucun commentaire:

Enregistrer un commentaire