Java. setOnClickListener (View.OnClickListener l), .. View.OnClickListener. , Activity View.OnClickListener.
. extends Activity implements OnClickListener. , import android.view.View.OnClickListener; , .
, Add unimplemented methods. .
@Overridepublic void onClick(View v) { // TODO Auto-generated method stub }-, Activity, . onCreate() . this, .. .
button1.setOnClickListener(this);. .
, . , , . , (long click). .
, / . . , ImageButton.
- ,
TextView , , ompoundButton. CompoundButton :
RadioButton () RadioGroup. . - RadioGroup RadioButton, , , TextView. - , .. RadioGroup, .
toggle(), . isChecked(), , setChecked(), .
radio1.setChecked(true); // radio1, setOnCheckedChangeListener() OnCheckedChangeListener.
, ( ) addView():
RadioGroup radiogroup = (RadioGroup)findViewByld(R.id.radioGroup); RadioButton newRadioButton = new RadioButton(this); newRadioButton.setText(""); radiogroup.addView(newRadioButton);