title: How to get ChildPosition in ExpandableListView agaist every group
body: <p>I have been spent almost two days to fix a bug but veined. Actually i want to select only one radiobutton in child group of every grouped item in expandablelistview. In this regard i am using this approach my adapter here here</p>
  
  <pre><code>public class AddToCartExpandable extends BaseExpandableListAdapter {
  
  Context context;
  ArrayList&lt;CartParentModel&gt; ListTerbaru;
  ArrayList&lt;ArrayList&lt;CartChildModel&gt;&gt; ListChildTerbaru;
  private RadioButton lastCheckedRB = null;
  private int selectedPosition = -1;
  public static boolean FLAG_CHECKBOX;
  private int selectedIndex = -1;
  private int mSelectedVariation;
  
  public AddToCartExpandable (Context context, 
  ArrayList&lt;CartParentModel&gt;ListTerbaru, ArrayList&lt;ArrayList&lt;CartChildModel&gt;&gt; 
  ListChildTerbaru){
      this.context=context;
      this.ListTerbaru=ListTerbaru;
      this.ListChildTerbaru=ListChildTerbaru;
  
  }
  @Override
  public boolean areAllItemsEnabled()
  {
      return true;
  }
  
  
  @Override
  public CartChildModel getChild(int groupPosition, int childPosition) {
      return ListChildTerbaru.get(groupPosition).get(childPosition);
  }
  
  @Override
  public long getChildId(int groupPosition, int childPosition) {
      return childPosition;
  }
  
  
  
  @Override
  public View getChildView(int groupPosition, final int childPosition, boolean 
    isLastChild, View convertView, ViewGroup parent) {
  
      final CartChildModel childTerbaru = getChild(groupPosition, 
      childPosition);
  
      AddToCartExpandable.ViewHolder holder= null;
      notifyDataSetChanged();
  
      if (convertView == null) {
          LayoutInflater infalInflater = (LayoutInflater) 
          context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          convertView = 
             infalInflater.inflate(R.layout.row_item_add_to_cart_child, null);
  
          holder=new AddToCartExpandable.ViewHolder();
          holder.radio_btn_item_name=
          (TextView)convertView.findViewById(R.id.radio_btn_item_name);
          holder.item_price_tv=
          (TextView)convertView.findViewById(R.id.item_price_tv);
  
          holder.radio_btn = convertView.findViewById(R.id.radio_btn);
       //  holder.radio_btn_group = convertView.findViewById(R.id.radio_btn_group);
         holder.check_btn = convertView.findViewById(R.id.check_btn);
  
  
          if(FLAG_CHECKBOX){
              childTerbaru.setCheckRequired(false);
              holder.radio_btn.setVisibility(View.INVISIBLE);
              holder.check_btn.setVisibility(View.VISIBLE);
          }
          else {
              childTerbaru.setCheckRequired(true);
              holder.radio_btn.setVisibility(View.VISIBLE);
              holder.check_btn.setVisibility(View.GONE);
          }
  
          holder.radio_btn_item_name.setText(childTerbaru.getChild_item_name());
  
      }
      else{
          holder=(AddToCartExpandable.ViewHolder)convertView.getTag();
      }
  
  
      if(selectedIndex == childPosition)
      {
          holder.radio_btn.setChecked(true);
      }
      else
      {
          holder.radio_btn.setChecked(false);
      }
     /* if(childTerbaru.isCheckedddd()){
          holder.radio_btn.setChecked(true);
     //     holder.check_btn.setChecked(true);
  
      }
      else
      {
          holder.radio_btn.setChecked(false);
       //   holder.check_btn.setChecked(false);
  
      }*/
  
      if(childTerbaru.isCheckBoxIsChecked()){
          holder.check_btn.setChecked(true);
      }
      else {
          holder.check_btn.setChecked(false);
      }
  
  
      holder.item_price_tv.setText(childTerbaru.getChild_item_price());
  
      convertView.setTag(holder);
      return convertView;
  }
  @Override
  public int getChildrenCount(int groupPosition) {
      return ListChildTerbaru.get(groupPosition).size();
  }
  
  @Override
  public CartParentModel getGroup(int groupPosition) {
      return ListTerbaru.get(groupPosition);
  }
  
  @Override
  public int getGroupCount() {
      return ListTerbaru.size();
  }
  
  @Override
  public long getGroupId(int groupPosition) {
      return groupPosition;
  }
  
  @Override
  public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
  
      CartParentModel terbaruModel = (CartParentModel) getGroup(groupPosition);
      AddToCartExpandable.ViewHolder holder= null;
      if (convertView == null) {
          LayoutInflater infalInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          convertView = infalInflater.inflate(R.layout.row_item_add_to_cart_parent, null);
  
          holder=new AddToCartExpandable.ViewHolder();
          holder.parent_tv=(TextView)convertView.findViewById(R.id.parent_tv);
  
          convertView.setTag(holder);
  
      }
  
      else{
          holder=(AddToCartExpandable.ViewHolder)convertView.getTag();
      }
  
      String checkRequired = terbaruModel.getRequired();
      if (checkRequired.equalsIgnoreCase("1")) {
  
          holder.parent_tv.setText(terbaruModel.getParentName() + " (Required)");
          FLAG_CHECKBOX = false;
      }
      else {
          holder.parent_tv.setText(terbaruModel.getParentName());
          FLAG_CHECKBOX = true;
      }
  
  
      return convertView;
  }
  
  @Override
  public boolean hasStableIds() {
      return true;
  }
  
  @Override
  public boolean isChildSelectable(int arg0, int arg1) {
      return true;
  }
  
  
  
  static class ViewHolder{
      TextView parent_tv,radio_btn_item_name,item_price_tv;
      RadioButton radio_btn;
      CheckBox check_btn;
     RadioGroup radio_btn_group;
  }
  
  private void itemCheckChanged(View v) {
      selectedPosition = (Integer) v.getTag();
      notifyDataSetChanged();
  }
  
  
  }
  
  public void setSelectedIndex(int index)
  {
      selectedIndex = index;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Also My Childclicklistner is here bellow</p>
  
  <pre><code>  cartExpandableListView.setOnChildClickListener(new 
        ExpandableListView.OnChildClickListener() {
                              @Override
                              public boolean onChildClick(ExpandableListView 
                expandableListView, View view, int groupPosition, int 
                        childPosition, long l) {
  
                                  CartChildModel item = (CartChildModel) 
                            listAdapter.getChild(groupPosition,childPosition);
  
                                  Toast.makeText(
                                          getApplicationContext(),
                                          item.getPos()
                                                  + " : "
                                                  , Toast.LENGTH_SHORT)
                                          .show();
  
                                  boolean iteIsRequired = 
                                                      item.isCheckRequired();
  
                                  if(!iteIsRequired) {
  
                                      CheckBox checkBox = 
                               view.findViewById(R.id.check_btn);
  
                                      if (checkBox != null) {
                                          checkBox.toggle();
  
                                          if (checkBox.isChecked()) {
                                              item.setCheckBoxIsChecked(true);
  
                             Toast.makeText(getApplicationContext(), 
                     item.getChild_item_name() + " checked" + "  
                   "+item.toString(), Toast.LENGTH_SHORT).show();
                                          } else {
  
                     item.setCheckBoxIsChecked(false);
  
                Toast.makeText(getApplicationContext(), 
                item.getChild_item_name() + " not checked", 
                Toast.LENGTH_SHORT).show();
                                          }
  
                                      }
                                  }
  
                              else {
  
                                  listAdapter.setSelectedIndex(groupPosition);
                                      listAdapter.notifyDataSetChanged();
  
  
                                  }
  
  
  
                                  return false;
                              }
                          });
  </code></pre>
  
  <p>Moreover </p>
  
  <pre><code>CartChildModel item = (CartChildModel) listAdapter.getChild(groupPosition,childPosition);
  </code></pre>
  
  <p>this is the way how i am getting child position. now the problem is this Model class object did not give position in integer formate if this gives the position in integer then my problem can solve.</p>