tweak unable-to-create-alert alert

And force a DEBUG-only crash so I can perhaps investigate
This commit is contained in:
Eric House 2020-09-06 11:24:38 -07:00
parent 22ad5aa4e2
commit b67870118e

View file

@ -19,6 +19,7 @@
package org.eehouse.android.xw4; package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@ -97,10 +98,10 @@ public class DBAlert extends XWDialogFragment {
Dialog dialog = activity.makeDialog( this, mParams ); Dialog dialog = activity.makeDialog( this, mParams );
if ( null == dialog ) { if ( null == dialog ) {
dialog = LocUtils.makeAlertBuilder( getActivity() ) Log.e( TAG, "no dialog for %s from %s", getDlgID(), activity );
.setTitle( "Stub Alert" ) Assert.failDbg();
.setMessage( String.format( "Unable to create for %s", dialog = LocUtils.makeAlertBuilder( activity )
getDlgID().toString() ) ) .setMessage( "Unable to create " + getDlgID() + " Alert" )
.setPositiveButton( "Bummer", null ) .setPositiveButton( "Bummer", null )
// .setNegativeButton( "Try now", new OnClickListener() { // .setNegativeButton( "Try now", new OnClickListener() {
// @Override // @Override
@ -115,10 +116,10 @@ public class DBAlert extends XWDialogFragment {
@Override @Override
public void run() { public void run() {
try { try {
MainActivity activity = (MainActivity)getActivity(); Activity activity = getActivity();
if ( null != activity ) { if ( null != activity && activity instanceof MainActivity ) {
DBAlert newMe = newInstance( getDlgID(), mParams ); DBAlert newMe = newInstance( getDlgID(), mParams );
activity.show( newMe ); ((MainActivity)activity).show( newMe );
dismiss(); // kill myself... dismiss(); // kill myself...
} else { } else {
Log.d( TAG, "null activity..." ); Log.d( TAG, "null activity..." );