title: method in custom adapter to check all checkboxes
body: <p>I am trying to check all checkboxes through the custom adapter with one button click. But when I implement </p>
  
  <pre><code>ArrayList&lt;BazarItems&gt; objects
  
      public void allChecked(){
  
          for (int i=0; i&lt;objects.size(); i++){
  
              cbBuy.setChecked(true);
          }
  
      }
  </code></pre>
  
  <p>the only last item is checked. 
  What am I doing wrong?</p>
  
  <p>have tried this one </p>
  
  <pre><code>`public void checkAll () {
  
          for (int i=0; i&lt;objects.size(); i++){
  
              BazarItems b = objects.get(i);
  
              b.box = true;
  
              cbBuy.setChecked(b.box);
          }
      }   
      `
  </code></pre>
  
  <p>here we go. I am probably missing something on custom adapter. In my understanding what I have should be enough to complete task.</p>
  
  <pre><code>`public class BazarListAdapter extends BaseAdapter {
  
      Context ctx;
      LayoutInflater lInflater;
      ArrayList&lt;BazarItems&gt; objects;
  
      CheckBox cbBuy;
  
      BazarListAdapter(Context context, ArrayList&lt;BazarItems&gt; products) {
          ctx = context;
          objects = products;
          lInflater = (LayoutInflater) ctx
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
  
      public int getCount() {
          return objects.size();
      }
  
      public Object getItem(int position) {
          return objects.get(position);
      }
  
      public long getItemId(int position) {
          return position;
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
  
          View view = convertView;
          if (view == null) {
              view = lInflater.inflate(R.layout.activity_bazar_list_child_item,
                      parent, false);
          }
  
          BazarItems i = getItems(position);
  
          ((TextView) view.findViewById(R.id.tvDescription)).setText(i.name);
          ((TextView) view.findViewById(R.id.tvQuantity))
                  .setText(i.quantity + "");
          ((TextView) view.findViewById(R.id.tvPrice)).setText(i.price + "");
  
          cbBuy = (CheckBox) view.findViewById(R.id.checkBox);
  
          cbBuy.setOnCheckedChangeListener(myCheckChangList);
  
          cbBuy.setTag(position);
  
          cbBuy.setChecked(i.box);
          return view;
      }
  
      BazarItems getItems(int position) {
          return ((BazarItems) getItem(position));
      }
  
      ArrayList&lt;BazarItems&gt; getBox() {
          ArrayList&lt;BazarItems&gt; box = new ArrayList&lt;BazarItems&gt;();
          for (BazarItems i : objects) {
              if (i.box)
                  box.add(i);
          }
          return box;
      }
  
      OnCheckedChangeListener myCheckChangList = new OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton buttonView,
                  boolean isChecked) {
              getItems((Integer) buttonView.getTag()).box = isChecked;
          }
      };
  </code></pre>
  
  <p>`</p>