diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index bc8f6d239..0f913639f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -2553,6 +2553,8 @@ public class BoardDelegate extends DelegateBase runOnUiThread( new Runnable() { @Override public void run() { + InviteChoicesAlert.dismissAny(); + if ( m_relayMissing && connected ) { m_relayMissing = false; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java index e88dd76b8..134feb485 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/InviteChoicesAlert.java @@ -26,6 +26,7 @@ import android.content.DialogInterface; import android.widget.Button; import android.widget.RadioGroup; +import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; @@ -40,15 +41,36 @@ import org.eehouse.android.xw4.loc.LocUtils; public class InviteChoicesAlert extends DlgDelegateAlert implements InviteView.ItemClicked { + private static WeakReference sSelf; + public static InviteChoicesAlert newInstance( DlgState state ) { InviteChoicesAlert result = new InviteChoicesAlert(); result.addStateArgument( state ); + sSelf = new WeakReference<>(result); return result; } + + public static void dismissAny() + { + WeakReference ref = sSelf; + if ( null != ref ) { + InviteChoicesAlert self = ref.get(); + if ( null != self ) { + self.dismiss(); + } + } + } public InviteChoicesAlert() {} + @Override + public void onDestroy() + { + sSelf = null; + super.onDestroy(); + } + @Override public void populateBuilder( final Context context, final DlgState state, AlertDialog.Builder builder )