user3816094 user3816094 - 1 month ago 18
Java Question

Why findViewByID can call without super keyword

I'm new to java and android programming. As far as I know,

findViewById
was defined on parent classes and I'm just curious about why
findViewById
method can call without
super
keyword in child class.

Answer

Without overriding the findViewById method in the child class, super and this are equivalent.

The view that you are trying to find is in this class, not the super class.

You can do this.findViewById(), or ActivityName.this.findViewById() but that is just redundant.

Related question to ask: Why doesn't setContentView need a super?