0

In my application I am making check boxes visible in list view through get view method .but when I click on any check box and scroll down the list ,there are some more check boxes which are getting checked simultaneously though I have never checked them ever.I am unable to find anything in this context.kindly help.

public class viewHolder {
        TextView top; 
        TextView bottom;
        TextView below;
        TextView idhold;
       CheckBox cb;
    } 


    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        viewHolder holder;
        if(convertView==null){


             LayoutInflater inflator=context.getLayoutInflater();
        convertView=inflator.inflate(R.layout.favouritetextviewonly, null);


        holder=new viewHolder();
        holder.top=(TextView)convertView.findViewById(R.id.topper);
        holder.bottom=(TextView)convertView.findViewById(R.id.lower);
        holder.below=(TextView)convertView.findViewById(R.id.lowest);
        holder.idhold=(TextView)convertView.findViewById(R.id.idholder);
--->        holder.cb=(CheckBox)convertView.findViewById(R.id.favouritecheckbox);
        convertView.setTag(holder);
        }

       else{
            holder=(viewHolder)convertView.getTag();
        }




        holder.top.setText(names[position]);
        holder.bottom.setText(types[position]);
        holder.below.setText(numbers[position]);
        holder.idhold.setText(""+keys[position]);
    ---->   holder.cb.setVisibility(View.VISIBLE);
        return convertView;
      } 
prof_jack
  • 2,023
  • 3
  • 18
  • 19
  • go for the link below u'll get ur answer..... http://stackoverflow.com/questions/7738527/getting-an-issue-while-checking-the-dynamically-generated-checkbox-through-list – himanshu Nov 30 '11 at 08:21
  • could you please paste your running code.I tried what was there in your question using pojo class but getting class cast exception. – prof_jack Nov 30 '11 at 10:39

0 Answers0