I have tried this:
public void onCheckboxClicked(View view) {
// La view è checked?
boolean checked = ((CheckBox) view).isChecked();
// Seleziona quale casella di controllo selezionare
switch (view.getId()) {
case R.id.checkBox:
if (checked)
Toast.makeText( getApplicationContext(), "Hai selezionato: " + checkBox.getText(), Toast.LENGTH_SHORT ).show();}
But I get this error:
java.lang.IllegalStateException: Could not execute method for android:onClick
The OnClick method is missing, but how can I use it together with the onCheckboxClicked method? Sorry I'm a beginner. Thanks
Aucun commentaire:
Enregistrer un commentaire