title: How to get the text from radio button in a radio group when radio button checked state is changed
body: <p>I have created two radio buttons in a radio group dynamically and one of them is checked.
  I need when i cheked another button then its value should be saved in string.
  But i have implemented <code>checkedchangelistener</code> for this.But its not working first time.
  Here is my code.</p>
  
  <pre><code>rg = ((RadioGroup)getActivity().findViewById(alist_id.get(i)));
  rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(){
      public void onCheckedChanged(RadioGroup rd, int checkedId) {
          for(int i=0; i&lt;rd.getChildCount(); i++) {
              radio_button = (RadioButton) rd.getChildAt(i);
              int id = radio_button.getId();
              if(radio_button.getId() == checkedId) {
                  text = radio_button.getText().toString();
                  flag=true;
                  System.out.println("trueeeeeeeee"+text);
                  return;
              }
          }
      }
  });
  if (flag==true) {
      updated_list.add(text);
      System.out.println("sssssssssssssssssss");
  }else {
      updated_list.add(data_from_list_view.get(i));
      System.out.println("falseeeeeee");
  }
  </code></pre>