radio group setOnCheckedChangeListener

后端 未结 4 1322
北荒
北荒 2021-01-05 03:37

I have some problem with radio group, I am new to Android development so I don\'t have much idea to how can handle it.This is form which has some input filed and radio group

4条回答
  •  独厮守ぢ
    2021-01-05 03:55

     radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
        {
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                // checkedId is the RadioButton selected
                RadioButton rb=(RadioButton)findViewById(checkedId);
                Toast.makeText(getApplicationContext(), rb.getText(), Toast.LENGTH_SHORT).show();
            }
        });
    

提交回复
热议问题