• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Android/Eclipse, connecting radio button selections to Checkbox selections

I am coding an android application and i have 2 radio buttons (in a radiogroup) that i want to control the behavior selection for checkboxes...so when i select radio button 1 (which equals 9 choices) should allow the user to only check 9 Checkboxes (even if there are twenty checkboxes. This is my code so far, am stuck

Code:
public class Main extends Activity{
Button button;
/** Called when the activity is first created. */

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    addListenerOnButton();

    final RadioButton radio0 = (RadioButton) findViewById(R.id.radio0);
    final RadioButton radio1 = (RadioButton) findViewById(R.id.radio1);
    radio0.setOnClickListener(radio_listener);
    radio1.setOnClickListener(radio_listener);

}

public OnClickListener radio_listener = new OnClickListener() {
    public void onClick(View v) {
        // Perform action on clicks
        RadioButton rb = (RadioButton) v;
        // allow user only to select 9 or 18 check box choices

        }
    });

}
  }
 
Back
Top Bottom