@Override public void onWindowFocusChanged(boolean hasWindowFocus) { // Ensure the the popup is not shown after resuming activity from background. if (hasWindowFocus && mNavigationPopup != null) { mNavigationPopup.dismiss(); mNavigationPopup = null; } super.onWindowFocusChanged(hasWindowFocus); }