java.lang.NullPointerException $ExpandableAdapter.getGroupView

You should change this

 ((CheckedTextView) convertView).setText(parentItems.get(groupPosition));
 ((CheckedTextView) convertView).setChecked(isExpanded);

With

   if (convertView == null) {

    LayoutInflater infalInflater = (LayoutInflater)_context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = infalInflater.inflate(R.layout.group_list, null);
     }

  TextView mGroupText = (TextView) convertView.findViewById(R.id.title);
  mGroupText.setText(parentItems.get(groupPosition));

  CheckBox mCheckBox = (CheckBox) convertView.findViewById(R.id.cb);
  mCheckBox.setChecked(isExpanded);

Your app crashed it’s because there no CheckedTextView in your group_list.xml layout file.

Leave a Comment