Code example for PopupWindow

Methods: getBackgroundsetBackgroundDrawable

    @SuppressWarnings("RedundantCast") //For some reason this is needed because of a compile error without it 
    public void testBackgroundDrawable() { 
      BitmapDrawable bitmapDrawable = new BitmapDrawable();
      assertThat((BitmapDrawable) popupWindow.getBackground()).isSameAs(bitmapDrawable);
    public void testTouchInterceptor() { 
      popupWindow.setTouchInterceptor(new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
          return event.getAction() == ACTION_DOWN;
      assertTrue(shadowOf(popupWindow).dispatchTouchEvent(obtain(1, 1, ACTION_DOWN, 1f, 1f, 0)));
Connect your IDE to all the code out there  Get Codota for Java