mercredi 4 avril 2018

How to add a new checkbox when i click a button?

I have tried this

public void newcheckbox(){
        LinearLayout my_layout = (LinearLayout)findViewById(R.id.my_layout);

        CheckBox checkBox = new CheckBox(getApplicationContext());
        checkBox.setText(""+ETnewcheckbox.getText().toString());
        my_layout.addView(checkBox);


    }

Aucun commentaire:

Enregistrer un commentaire