This line:
CustomAdapter adapter = new CustomAdapter(this, list);
creates a local variable, so the field adapter never gets initialized. Instead you want to assign the newly created adapter to the field with:
adapter = new CustomAdapter(this, list);