private void checkDialogDisplay() {
        final Activity currentActivity = CgeoApplication.getInstance().getCurrentForegroundActivity();
        if (state == State.DIALOG_WAITING && currentActivity != null && displayAllowedChecker.test(currentActivity)) {
            closeCurrentDialog();
            displayDialogForCurrentProvider(currentActivity);
        }
        if (state == State.DIALOG_DISPLAYED && currentActivity == null) {
            //close dialog, but prepare to re-open when activity comes back
            currentDialogControl.dismissWithoutUserResult();
            state = State.DIALOG_WAITING;
        }
    }
called after a change in activities. Checks if a waiting dialog can now be displayed
main/src/main/java/cgeo/geocaching/wherigo/WherigoDialogManager.java