In my service I add a view to WindowManager with addView(). When I\'m ready to hide the view, I call removeView() using the View
WindowManager
addView()
removeView()
View
You can also use:
ViewCompat.isAttachedToWindow(mView);
According the docs:
Returns true if the provided view is currently attached to a window.