samedi 6 mai 2017

Android Expandable listview on scroll it changes selected checkbox state

I am using expandable listview in group parent level i am having checkbox

  @Override
        public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
            View view = convertView;
            ViewHolder holder = new ViewHolder();
            if(view == null){
                LayoutInflater infalInflater = (LayoutInflater) this._context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             //   convertView = infalInflater.inflate(R.layout.home_activity_lv_sync_adapter, null);
                view = infalInflater.inflate(R.layout.home_activity_lv_sync_adapter, null);

                holder.ckupdate = (CheckBox) view.findViewById(R.id.ck_update);

                view.setTag(holder);
            } else {
                holder = (ViewHolder) view.getTag();
            }
            holder.ckupdate.setTag(groupPosition);
            holder.ckupdate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

                    int position = (Integer) buttonView.getTag();
                   // objects.get(position).setChecked(buttonView.isChecked());
                }
            });
           // holder.ckupdate.setChecked(isChecked(position));

            return view;
        }

But when i am scrolling exp list it changes state( i am not taking data from any list or DB just user check and unchecked )

thanks in advance




Aucun commentaire:

Enregistrer un commentaire