Advertisement
reinaldoseki

Exemplo de Número Randômico - Android Studio

Oct 21st, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. public class MainActivity extends AppCompatActivity {
  2. EditText edtN1,edtN2, edtN3, edtResultado,edtVerNumero, edtNumero;
  3. Integer numeroAleatorio, n1,n2,n3;
  4. Button btnJogar, btnExibirQualquer;
  5. Random numeroRandomico = new Random();
  6.  
  7.  
  8. btnExibirQualquer.setOnClickListener(new View.OnClickListener() {
  9. @Override
  10. public void onClick(View v) {
  11. numeroAleatorio = numeroRandomico.nextInt(10);
  12. edtNumero.setText("O número é: " + numeroAleatorio);
  13. }
  14. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement