diff --git a/app/src/main/java/fr/free/nrw/commons/utils/DialogUtil.java b/app/src/main/java/fr/free/nrw/commons/utils/DialogUtil.java index e9765551ce..0ce8ca9c9e 100644 --- a/app/src/main/java/fr/free/nrw/commons/utils/DialogUtil.java +++ b/app/src/main/java/fr/free/nrw/commons/utils/DialogUtil.java @@ -116,6 +116,13 @@ private static void showAlertDialog(Activity activity, final Runnable onNegativeBtnClick, View customView, boolean cancelable) { + // If the custom view already has a parent, there is already a dialog showing with the view + // This happens for on resume - return to avoid creating a second dialog - the first one + // will still show + if (customView != null && customView.getParent() != null) { + return; + } + AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(title); builder.setMessage(message);