i add a view in the windowManager via mWindowManager.addview()
. Now i would like to know if it's possible to get the window
instance. their is myView.getWindowID()
and myView.getWindowToken()
but i can't find a way to retrieve from it the window instance
If your View
has been attached to Activity
, you can do like this.
View view; // your view
if (view.getContext() instanceof Activity) {
Window window = ((Activity) view.getContext()).getWindow();
}
After API 19, there is a convenient method to check, view.isAttachedToWindow()
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