LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
LayoutParams.TYPE_APPLICATION_OVERLAY,
0, PixelFormat.TRANSLUCENT);
- InstrumentationRegistry.getContext()
- .getSystemService(WindowManager.class).addView(view, lp);
+ view.getContext().getSystemService(WindowManager.class).addView(view, lp);
}
+ /**
+ * Causes the view (and its children) to have {@link View#onDetachedFromWindow()} called.
+ *
+ * This is currently done by removing the view from a window.
+ */
public static void detachView(View view) {
- InstrumentationRegistry.getContext()
- .getSystemService(WindowManager.class).removeViewImmediate(view);
+ view.getContext().getSystemService(WindowManager.class).removeViewImmediate(view);
}
}