move setRemoveOnDismiss into delegate, and call it from a dialog

that's been crashing when called from performRestoreInstanceState.
The hope is that this will prevent the crash by forcing the dialog to
always be recreated.  But it may be that I just need to test for
m_missingDictNames being null....
This commit is contained in:
Andy2 2011-04-26 18:26:21 -07:00
parent 83f2882589
commit a5fd4cef30
4 changed files with 19 additions and 8 deletions

View file

@ -75,6 +75,17 @@ public class DlgDelegate {
return dialog;
}
protected void setRemoveOnDismiss( Dialog dialog, final int id )
{
dialog.setOnDismissListener( new DialogInterface.OnDismissListener() {
public void onDismiss( DialogInterface di ) {
Utils.logf( "%s.onDismiss() called",
getClass().getName() );
m_activity.removeDialog( id );
}
} );
}
public void onPrepareDialog( int id, Dialog dialog )
{
AlertDialog ad = (AlertDialog)dialog;

View file

@ -124,6 +124,7 @@ public class GamesList extends XWListActivity
ab.setNeutralButton( R.string.button_substdict, lstnr );
}
dialog = ab.create();
setRemoveOnDismiss( dialog, id );
break;
case SHOW_SUBST:
m_sameLangDicts =

View file

@ -79,15 +79,9 @@ public class XWActivity extends Activity {
return dialog;
}
protected void setRemoveOnDismiss( Dialog dialog, final int id )
protected void setRemoveOnDismiss( Dialog dialog, int id )
{
dialog.setOnDismissListener( new DialogInterface.OnDismissListener() {
public void onDismiss( DialogInterface di ) {
Utils.logf( "%s.onDismiss() called",
getClass().getName() );
removeDialog( id );
}
} );
m_delegate.setRemoveOnDismiss( dialog, id );
}
@Override

View file

@ -83,6 +83,11 @@ public class XWListActivity extends ListActivity {
return dialog;
}
protected void setRemoveOnDismiss( Dialog dialog, int id )
{
m_delegate.setRemoveOnDismiss( dialog, id );
}
@Override
protected void onPrepareDialog( int id, Dialog dialog )
{