Tell me please .. made my markup for group headers in ExpandableListView . In the adapter wrote the following:
public class ExpListAdapter extends SimpleCursorTreeAdapter { DBHeler dbHeler; private int layout; public ExpListAdapter(Context context, Cursor cursor, int groupLayout, String[] groupFrom, int[] groupTo, int childLayout, String[] childFrom, int[] childTo) { super(context, cursor, groupLayout, groupFrom, groupTo, childLayout, childFrom, childTo); this.layout = childLayout; } @Override public View newGroupView(Context context, Cursor cursor, boolean isExpanded, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(layout, parent, false); ViewHolder viewHolder = new ViewHolder(view); view.setTag(viewHolder); return view; } @Override protected void bindGroupView(View view, Context context, Cursor cursor, boolean isExpanded) { super.bindGroupView(view, context, cursor, isExpanded); ViewHolder holder = (ViewHolder) view.getTag(); String category = cursor.getString(cursor.getColumnIndex(Contract.Entry.COLUMN_NAME)); holder.txtCategory.setText(category); } } I get the error:
Process: test.myapp, PID: 6572 java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText (java.lang.CharSequence) (ExpListAdapter.java:82)