public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button roll_Button = findViewById(R.id.rollButton);
final TextView result_TextView = findViewById(R.id.resutlsTextView);
final SeekBar seekBar = findViewById(R.id.seekBar);
roll_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Random rand = new Random();
int nr = rand.nextInt(seekBar.getProgress() + 1);
result_TextView.setText(Integer.toString(nr));
}
}
);
}
}
what is wrong here? Nothing is displayed on the screen when I click on ROLL. I written the code in Java. That is a problem with Android Studio?
Aucun commentaire:
Enregistrer un commentaire