lundi 25 juillet 2016

Issues in Expandable listview with checkbox

My Requirement is when i select on parent checkbox selected child checkboxes simultaneously.But i am click on parent checkbox it not selected child checkbox.how to do this can any on give suggestions

   public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, final ViewGroup parent) {
    final String headerTitle = (String)getGroup(groupPosition);
    ParentViewHolder cv = null;
    if (convertView == null)
    {
        LayoutInflater li = (LayoutInflater)Context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = li.inflate(R.layout.group_list,null);
      cv  = new ParentViewHolder();
       cv.text = (TextView)convertView.findViewById(R.id.groupTitle);
        cv.text.setTypeface(null, Typeface.BOLD);
        cv.text.setText(headerTitle);
        cv.parentCheckbox =       (CheckBox)convertView.findViewById(R.id.groupCheckbox);

        convertView.setTag(cv);
        cv.parentCheckbox.setTag(groupPosition);
        cv.parentCheckbox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(((CheckBox)v).isChecked())
                {
                    Log.e("TAG","clicked");
                        groupitem.itemClick(groupPosition, true);
                    Toast.makeText(Context.getApplicationContext(),   headerTitle+"success", Toast.LENGTH_SHORT).show();
                }
            }
        });

    }
    else
    {

    }

        return convertView;
} 




Aucun commentaire:

Enregistrer un commentaire