Hello i have a problem in this code i make a true or false game on andorid the problem is this practically the game onward the 2 round because the variable(int round) is not increase the value of variable stay always 2 then Never goes to the third question
public class Livello extends Activity {
int livello;
int punteggio;
Verifica verifico = new Verifica();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_livello);
Intent intent =getIntent();
String pkg=getPackageName();
livello =intent.getIntExtra(pkg+".myInt",-1);
if(livello==1) {
Start1();
}
}
public void Start1(){
verifico.question = (TextView) findViewById(R.id.domande);
verifico.vero =(Button)findViewById(R.id.vero);
verifico.falso =(Button)findViewById(R.id.falso);
punteggio= verifico.punteggio;
verifico.Controllo1();
}
}
verifica.class
public class Verifica extends Activity{
Button vero;
Button falso;
TextView question;
int punteggio;
int round;
InizioRound inizioround = new InizioRound();
public void Controllo1(){
inizioround.question=question;
round=1;
round = inizioround.livello1(1);
vero.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
punteggio++;
round = inizioround.livello1(2);
}
});
falso.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
round = inizioround.livello1(2);
}
});
if(round == 2){
vero.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
punteggio++;
round = inizioround.livello1(3);
inizioround.livello1(3);
Log.e("vaa", "round=" + round);
}
});
} else if(round == 3){
round = inizioround.livello1(3);
falso.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
punteggio++;round = inizioround.livello1(4);
}
});
} else if(round == 4){
falso.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
punteggio++;round = inizioround.livello1(5);
}
});
} else if(round == 5){
round = inizioround.livello1(5);
falso.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
punteggio++;round = inizioround.livello1(5);
}
});
}
}
}
inizioround.class
public class InizioRound extends Activity{
TextView question;
public int livello1(int round){
if(round == 1){
question.setText(R.string.dl1);
round=1;
} else if(round == 2){
question.setText(R.string.dl2);
round=2;
} else if(round == 3){
question.setText(R.string.dl3);
round=3;
} else if(round == 4){
question.setText(R.string.dl4);
round=4;
} else if(round == 5){
question.setText(R.string.dl5);
round=5;
}
return round;
}
}