final RadioGroup radioGroup1 = (RadioGroup) findViewById(R.id.radiogroup);
final TextView tv=(TextView) findViewById(R.id.textView1);
Button mSubmitButton = (Button) findViewById(R.id.btnSubmit);
relation.setOnItemSelectedListener(new CustomOnItemSelectedListener());
radioGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
String text1;
@Override
public void onCheckedChanged(RadioGroup group, int checkedId)
{
RadioButton checkedRadioButton = (RadioButton) findViewById(checkedId);
text1 = checkedRadioButton.getText().toString();
Toast.makeText(getApplicationContext(), text1, Toast.LENGTH_SHORT).show();
}
});
mSubmitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String fName = first_name.getText().toString();
String re_lation = (String) relation.getSelectedItem();
String add_ress = address.getText().toString();
}
ここで、Onclick関数内で、onCheckedChangedからtext1値を取得したいのですが、onclick関数内でtext1値を取得するにはどうすればよいですか?