error: while expected / eached end of file while parsing

-2

guys, I'm having trouble with my Bingo app

public class MainActivity extends AppCompatActivity {
    int[] ids = {R.id.button2, R.id.button3, R.id.button4, R.id.button5, R.id.button6, R.id.button7,
            R.id.button8, R.id.button9, R.id.button10, R.id.button11, R.id.button12, R.id.button13, R.id.button14,
            R.id.button15, R.id.button16, R.id.button17, R.id.button18, R.id.button19, R.id.button20, R.id.button21,
            R.id.button22, R.id.button23, R.id.button24, R.id.button25, R.id.button26};
    int cont = 0;
    int[] vetaux = new int[25];
    boolean isRepetido = false;
    Random sorteador = new Random();
    int n1 = 0;
    boolean y = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        do {
            n1 = sorteador.nextInt(100);
            for (int cont1 = 0; cont1 < cont; cont1++) {
                if (vetaux[cont1] == n1) {
                    y = true;
                    break;
                } else {
                    y = false;
                }
            }
            if (y == false) {
                vetaux[cont] = n1;
                cont++;
            }
            while (cont < 25) ;
            {
            //int Nsorteado = sorteador.nextInt(100);//Nsorteado armzenou o numero
            for (int cont = 0; cont < ids.length; cont++) {
                int Id = ids[cont];
                int n1 = vetaux[cont];
                String txt1 = String.valueOf(n1);
                Button button = (Button) findViewById(Id);
                button.setText(txt1);
            }

        }
    } 
}
  

error: while expected   error: reached end of file while parsing

    
asked by anonymous 25.09.2017 / 20:11

1 answer

0

You have opened the keys after performing a while, as if it were a normal while, try this, remove that { single that is after your while :

public class MainActivity extends AppCompatActivity {
int[] ids = {R.id.button2, R.id.button3, R.id.button4, R.id.button5, R.id.button6, R.id.button7,
        R.id.button8, R.id.button9, R.id.button10, R.id.button11, R.id.button12, R.id.button13, R.id.button14,
        R.id.button15, R.id.button16, R.id.button17, R.id.button18, R.id.button19, R.id.button20, R.id.button21,
        R.id.button22, R.id.button23, R.id.button24, R.id.button25, R.id.button26};
int cont = 0;
int[] vetaux = new int[25];
boolean isRepetido = false;
Random sorteador = new Random();
int n1 = 0;
boolean y = false;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    do {
        n1 = sorteador.nextInt(100);
        for (int cont1 = 0; cont1 < cont; cont1++) {
            if (vetaux[cont1] == n1) {
                y = true;
                break;
            } else {
                y = false;
            }
        }
        if (y == false) {
            vetaux[cont] = n1;
            cont++;
        }
        while (cont < 25) ;
        //int Nsorteado = sorteador.nextInt(100);//Nsorteado armzenou o numero
        for (int cont = 0; cont < ids.length; cont++) {
            int Id = ids[cont];
            int n1 = vetaux[cont];
            String txt1 = String.valueOf(n1);
            Button button = (Button) findViewById(Id);
            button.setText(txt1);
        }

    }
} 


}
    
25.09.2017 / 20:18