title: Is there a way to check if android WindowManager already contains a view?
body: <p>When I try to do a WindowManager.removeView(),</p>
  
  <pre><code>E/AndroidRuntime( 2445): java.lang.IllegalArgumentException: View=android.widget.LinearLayout{41a03700 V.E..... ......I. 0,0-0,0} not attached to window manager
  
  E/AndroidRuntime( 2445):             at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:370)
  
  E/AndroidRuntime( 2445):             at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:299)
  
  E/AndroidRuntime( 2445):             at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79)
  </code></pre>
  
  <p>I get this fatal error because the view was not in the window manager.
  Is there no way to check if windowmanager had already added the view before?
  I do not see any such method in the <a href="https://android.googlesource.com/platform/frameworks/base/+/211370fd943cf26905001b38b8b1791851b26adc/core/java/android/view/WindowManagerImpl.java" rel="noreferrer">source</a> </p>