Just playing around a bit (I do know View.getRootView()
), I manually stepped my way up to the root and even beyond.
...
View tv=(View)mv.getParent();
View uv=(View)tv.getParent();
...
Actually I thought that at one point I would run into a NullPointerException
, but instead I got
03-18 13:07:45.554 13568 13568 E AndroidRuntime: java.lang.ClassCastException: android.view.ViewRootImpl cannot be cast to android.view.View
Okay, fine, that looks reasonable, too.
I didn't know about ViewRootImpl
yet, so I decided to pick up the topic and investigate it a bit.
However, when I do
ViewRootImpl wv=(View)vv.getParent();
I get a (deserved)
[javac] /home/jagged/Downloads/android/motog/firsttry/src/tk/wellthen/main.java:285: cannot find symbol
[javac] symbol : class ViewRootImpl
[javac] location: class tk.wellthen.main
[javac] ViewRootImpl wv=(View)vv.getParent();
[javac] ^
from the compiler, but still, when I fully qualify it according to the logcat output above, I get the (almost) same error message. (And I even copy-pasted it from the logcat output to avoid typos.)
Needless to say that upon trying to import android.view.ViewRootImpl
. the same message appeared, just for another source line.
Also, Google doesn't seem to find it useful to mention it even with a single word throughout the API docs. I take it that it is mainly used for internals, but that's no reason if you ask me.
There are 138 hits for "ViewRootImpl
" on stackoverflow.com (well, now it should be at least 139), but they are completely irrelevant in this context (if I didn't miss something special).
I've taken a look at some other sites, and found, for example, this source code, but I somehow doubt it'd be useful to fake it into the SDK in order to explore it?
Any advices? Thanks in advance
ViewRootImpl
is annotated with @hide
. This excludes the class from the stub android.jar
used for development. The class is there on an actual runtime environment.
See also: What does @hide mean in the Android source code?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With