Haven’t seen a tutorial for this that isn’t badly spelled and hard to grok, so I’ll try it. First, include the radio group widget and and declare one. You’ll also need LayoutParams and RadioButton, so include those as well.
1 2 3 4 5 6 7 8 9 |
//SomeAndroidActivity import android.widget.RadioGroup; import android.view.ViewGroup.LayoutParams; import android.widget.RadioButton; public class SomeAndroidActivity extends Activity () { //declare a radio group RadioGroup radioGroup; } |
Inside your onCreate method, initialize the radio group.
1 2 3 4 5 6 7 8 |
//SomeAndroidActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_some_android); radioGroup = (RadioGroup) findViewById(R.id.radio_selection_group); } |
R.id.radio_selection_group is referring to a radio […]