What is the difference between View.findViewById () and Activity.findViewById ()?

I am new to Android programming. I have a confusion between View.findViewById()and Activity.findViewById()when we should call these methods and in which class findViewById()is in class Viewor Activity.

Any help would be appreciated.

+4
source share
2 answers

In the viewing version, the view you are calling it is viewed, and all its subspecies. In the first step, a search is performed in the top-level view specified in setContentView and in all its areas. This operation is equivalent to calling View.findViewById in the contentView activity.

, , .

+9

Activity.findViewById() - , View.findViewById() . . View.findViewById().

0

Source: https://habr.com/ru/post/1584110/


All Articles