private void displayDialogForCurrentProvider(final Activity activity) {

        if (currentDialogControl != null || currentDialogProvider == null) {
            return;
        }

        //create a unique dialog id to check in callbacks if this is still the right dialog
        final int dialogId = currentDialogId.addAndGet(1);

        currentDialogControl = WherigoDialogControl.createAndShowDialog(activity, currentDialogProvider, isPause -> executeAction(() -> {
            if (currentDialogId.get() == dialogId) {
                closeCurrentDialog();
                if (isPause) {
                    state = State.DIALOG_PAUSED;
                    final Activity currentActivity = CgeoApplication.getInstance().getCurrentForegroundActivity();
                    if (currentActivity != null) {
                        ViewUtils.showToast(null, R.string.wherigo_dialog_pause_info);
                    }
                } else {
                    this.currentDialogProvider = null;
                    state = State.NO_DIALOG;
                }
            }
        }));
        state = State.DIALOG_DISPLAYED;
    }
opens currently waiting dialog in given activity
main/src/main/java/cgeo/geocaching/wherigo/WherigoDialogManager.java