0

i have structure like this

TextView
radio1 radio2

TextView
radio1 radio2

TextView
radio1 radio2

i want to known how can i get the all checked radio button on a button click i tried like this

submit.setOnClickListener(new View.OnClickListener() {              
            @Override
            public void onClick(View v) {
                RadioGroup rgp;
                RadioButton rbtn;
                for(int i =0;i<listView.getChildCount();i++){
                    View layout =  listView.getChildAt(i);
                      //int text =    layout.getChildAt(1).getId();
                  int text =  (((ViewGroup) layout).getChildAt(1)).getId();


                       rgp = (RadioGroup)findViewById(text); 

                         rbtn = (RadioButton)findViewById(rgp.getCheckedRadioButtonId());
                    Toast.makeText(getApplicationContext(), ""+rbtn.getText().toString(),Toast.LENGTH_SHORT).show();
                }

            }
        });
Ravi
  • 34,851
  • 21
  • 122
  • 183
Tomesh Sahu
  • 25
  • 1
  • 4

0 Answers0