findViewById() returns null for custom component in layout XML, not for other components

Because in the constructor, I had super(context) instead of super(context, attrs).

Makes sense, if you don’t pass in the attributes, such as the id, then the view will have no id and therefore not be findable using that id. 🙂

Leave a Comment