What is the difference between findViewById(R.id.content) and getRootView() ? Don't both return the root view of an activity?
Asked
Active
Viewed 4,863 times
1 Answers
8
The method findViewById(R.id.content)
searches down the view hierarchy for a View with the id content
(it examines itself as well).
The method getRootView()
walks up view hierarchy until it hits the root View (it examines itself as well).
If the View you are in has the id content
and it is the root view then these methods will give the same result, otherwise they won't.

Juuso Ohtonen
- 8,826
- 9
- 65
- 98

satur9nine
- 13,927
- 5
- 80
- 123