안드로이드 응용 프로그램을 만드는 데 초보자입니다. OnCreate 메서드 내에서 AXML의 개체를 사용할 수는 있지만 이벤트 처리기 radioButton_Click에서 사용할 수는 없습니다. 이벤트 처리기 radioButton_Click에서 사용하는 방법을 알지 못해도됩니다.외부에서 UI 개체 사용하기 OnCreate 방법
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
RadioButton radioButton1 = FindViewById<RadioButton>(Resource.Id.radioButton1);
RadioButton radioButton2 = FindViewById<RadioButton>(Resource.Id.radioButton2);
radioButton1.Click += radioButton_Click;
radioButton2.Click += radioButton_Click;
//radioButton1 and radioButton2 are recognized here.
}
void radioButton_Click(object sender, EventArgs e)
{
//radioButton1 and radioButton2 are not recognized here.
//I want to know how to use IN THIS METHOD the objects loaded from the AXML
// in OnCreate (the two radio buttons)
}