@Test @MediumTest public void testDismissalViaAPI() throws Throwable { Builder menuBuilder = new Builder().withDismissListener(); menuBuilder.wireToActionButton(); onView(withId(R.id.test_button)).perform(click()); mActivityTestRule.runOnUiThread(new Runnable() { @Override public void run() { mPopupMenu.dismiss(); } }); verify(menuBuilder.mOnDismissListener, times(1)).onDismiss(mPopupMenu); onView(withClassName(Matchers.is(DROP_DOWN_CLASS_NAME))).check(doesNotExist()); }
public void dismiss() { mPopup.dismiss(); }
PopupMenu { public void dismiss() { mPopup.dismiss(); } }
PopupMenu { public void dismiss() { mPopup.dismiss(); } PopupMenu(@NonNull Context context, @NonNull View anchor);  PopupMenu(@NonNull Context context, @NonNull View anchor, int gravity);  PopupMenu(@NonNull Context context, @NonNull View anchor, int gravity,
            @AttrRes int popupStyleAttr, @StyleRes int popupStyleRes); }
PopupMenu { public void dismiss() { mPopup.dismiss(); } PopupMenu(@NonNull Context context, @NonNull View anchor);  PopupMenu(@NonNull Context context, @NonNull View anchor, int gravity);  PopupMenu(@NonNull Context context, @NonNull View anchor, int gravity,
            @AttrRes int popupStyleAttr, @StyleRes int popupStyleRes); void setGravity(int gravity); int getGravity(); @NonNull View.OnTouchListener getDragToOpenListener(); @NonNull Menu getMenu(); @NonNull MenuInflater getMenuInflater(); void inflate(@MenuRes int menuRes); void show(); void dismiss(); void setOnMenuItemClickListener(@Nullable OnMenuItemClickListener listener); void setOnDismissListener(@Nullable OnDismissListener listener); }
PopupMenu { public void dismiss() { mPopup.dismiss(); } PopupMenu(@NonNull Context context, @NonNull View anchor);  PopupMenu(@NonNull Context context, @NonNull View anchor, int gravity);  PopupMenu(@NonNull Context context, @NonNull View anchor, int gravity,
            @AttrRes int popupStyleAttr, @StyleRes int popupStyleRes); void setGravity(int gravity); int getGravity(); @NonNull View.OnTouchListener getDragToOpenListener(); @NonNull Menu getMenu(); @NonNull MenuInflater getMenuInflater(); void inflate(@MenuRes int menuRes); void show(); void dismiss(); void setOnMenuItemClickListener(@Nullable OnMenuItemClickListener listener); void setOnDismissListener(@Nullable OnDismissListener listener);  }