title: Expandable List view child item selection in android?
body: <p>In expandable list view set the data based on the parent. In this parent has child item selection, the selection set image view for each child item selection. But in this selection set the other parents child items.  </p>
  
  <p><strong>Below code for parent value set.</strong></p>
  
  <pre><code>@Override
      public View getGroupView(final int i, boolean b, View view, ViewGroup viewGroup) {
          GroupViewHolder groupViewHolder;
          if(view==null){
              groupViewHolder=new GroupViewHolder();
              view=((LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.category_listview_group_item,null);
              groupViewHolder.name=(TextView)view.findViewById(R.id.category_listview_item_name);
              groupViewHolder.nameIcon=(ImageView)view.findViewById(R.id.category_listview_item_icon);
              groupViewHolder.progressBar = (ProgressBar)view.findViewById(R.id.categoryImageProgressBarlist);
              groupViewHolder.rigtharrow=(ImageButton)view.findViewById(R.id.category_listview_item_onclick);
              view.setTag(groupViewHolder);
          } else {
              groupViewHolder=(GroupViewHolder)view.getTag();
          }
          groupViewHolder.nameIcon =itemImage(view, R.id.category_listview_item_icon, data.get(i).getImageUrl(), groupViewHolder.progressBar);
          groupViewHolder.name.setText(data.get(i).getName());
          return view;
      }
  </code></pre>
  
  <p><strong>Below code for child item value set</strong></p>
  
  <pre><code>@Override
      public View getChildView(final int i, final int i1, boolean b,  View view, ViewGroup viewGroup) {
          final ChildViewHolder childViewHolder;
          String[] spinnerCount = {"1","2","3","4","5"};
          if(view==null) {
              childViewHolder = new ChildViewHolder();
              view = ((LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.category_listview_child_item,null);
              childViewHolder.childName = (TextView)view.findViewById(R.id.listview_child_item_name);
              childViewHolder.childNamePrice = (TextView)view.findViewById(R.id.listview_child_item_price);
              childViewHolder.childNameIcon = (ImageView)view.findViewById(R.id.listview_child_item_icon);
              childViewHolder.spinner = (Spinner)view.findViewById(R.id.spinner);
  
  
             view.setTag(childViewHolder);
  
          }
          else {
              childViewHolder=(ChildViewHolder)view.getTag();
          }
  
  
          childViewHolder.childNameIcon.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  if (!childViewHolder.childNameIcon.isSelected()) {
                      childViewHolder.childNameIcon.setBackgroundResource(R.mipmap.yellow_circle_list_item);
                      childViewHolder.childNameIcon.setSelected(true);
                      //  childViewHolder.childNameIcon.setTag(R.mipmap.yellow_circle_list_item);
                      String quantity = childViewHolder.spinner.getSelectedItem().toString();
                      Products product = data.get(i).getProductsList().get(i1);
                      product.setQuantity(quantity);
                      dataHandler.addTempproducts(product);
                  } else {
                      childViewHolder.childNameIcon.setBackgroundResource(R.mipmap.black_circle_list_item);
                      childViewHolder.childNameIcon.setSelected(false);
                      //  childViewHolder.childNameIcon.setTag(R.mipmap.black_circle_list_item);
                      dataHandler.removeTempProducts(data.get(i).getProductsList().get(i1));
                      Products product = data.get(i).getProductsList().get(i1);
                      product.setQuantity("1");
                   }
              }
          });
  
  
          ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(context,android.R.layout.simple_spinner_item,spinnerCount);
          childViewHolder.spinner.setAdapter(adapter);
  
          childViewHolder.spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
              @Override
              public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) {
                  String spinnerCount = childViewHolder.spinner.getSelectedItem().toString();
                  Products product = data.get(i).getProductsList().get(i1);
                  ArrayList&lt;Products&gt; productList = new ArrayList&lt;Products&gt;();
                  productList = dataHandler.getTempproducts();
                  if (childViewHolder.childNameIcon.isSelected()) {
                      for (int k = 0; k &lt; productList.size(); k++) {
                          if (data.get(i).getProductsList().get(i1).getId() == productList.get(k).getId()) {
                              productList.get(k).setQuantity(spinnerCount);
                          }
                      }
                  } else {
                      product.setQuantity(spinnerCount);
                  }
              }
  
              @Override
              public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
                  // TODO Auto-generated method stub
              }
          });
  
  
    childViewHolder.childName.setText(data.get(i).getProductsList().get(i1).getName());
          if(data.get(i).getProductsList().get(i1).getPrice().isEmpty()) {
              childViewHolder.childNamePrice.setText(data.get(i).getProductsList().get(i1).getPrice());
          } else {
              childViewHolder.childNamePrice.setText(data.get(i).getProductsList().get(i1).getPrice()+"/-");
          }
  
          return view;
      }
  </code></pre>
  
  <p>Please Help me , i am struct here.......</p>