title: How to set default SELECT for radio button in radio group
body: <p>I had created a dynamic radio group which contain onClickListener for each radio button when click. How can i set the first item in the radio group as default selected INCLUDING the onClick action for the first item.</p>
  
  <p>I had try with the code<code>((RadioButton)radioGroup.getChildAt(0)).setChecked(true);</code> but it only set the item as checked but did not perform any onClick action. <br><br> Below is what i done for my dynamic radio button.</p>
  
  <pre><code>public static void createRoutemapButton(final Activity activity, final List&lt;DORouteMapInfo&gt; list, final FlexRadioGroup flexRadioGroup, final ImageView imageView){
      LayoutInflater inflater = LayoutInflater.from(activity);
  
      float margin = DensityUtils.dp2px(activity, 85);
      float width = DensityUtils.getWidth(activity);
  
      for (final DORouteMapInfo routeMap : list) {
          final RadioButton rb = (RadioButton) inflater.inflate(R.layout.item_radiobutton_label, null);
          rb.setText(routeMap.getTitle());
          FlexboxLayout.LayoutParams params = new FlexboxLayout.LayoutParams((int) (width - margin) / 2, ViewGroup.LayoutParams.WRAP_CONTENT);
          params.setMargins(5,0,5,5);
          rb.setLayoutParams(params);
          rb.setPadding(0,10,0,10);
          flexRadioGroup.addView(rb);
  
          flexRadioGroup.setOnCheckedChangeListener(new FlexRadioGroup.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(@IdRes int checkedId) {
              }
          });
          rb.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Picasso.with(activity)
                          .load(routeMap.getImageURL())
                          .fit().centerInside()
                          .into(imageView);
              }
          });
      }
  } 
  </code></pre>