method:setOnCheckedChangeListener ( RadioGroup.OnCheckedChangeListener listener )
return type:void
content:ใช้กำหนด การดักฟังเหตุการณ์ เมื่อมีการเปลี่ยนแปลงการ checked ที่ RadioButton
example:public class BambooAndroid extends Activity implements OnCheckedChangeListener
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
RadioGroup radio_group = new RadioGroup ( this );
RadioButton radio_button_1 = new RadioButton ( this );
radio_button_1.setId ( 1 );
RadioButton radio_button_2 = new RadioButton ( this );
radio_button_2.setId ( 2 );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 30 );
radio_group.addView ( radio_button_1, 0, params );
radio_group.addView ( radio_button_2, 1, params );
radio_group.check ( 2 );
radio_group.setOnCheckedChangeListener ( this );
setContentView ( radio_group );
}
public void onCheckedChanged ( RadioGroup group, int checkedId )
{
}
}