don't return dialog when msgID is 0. This should fix occasional crash

where OS wants to restore a dialog but the message ID has gotten
cleared -- via a mechanism I'm not quite clear on.
This commit is contained in:
Andy2 2010-12-08 18:52:08 -08:00
parent a1c96b5601
commit d5d81fea5b

View file

@ -179,31 +179,36 @@ public class DlgDelegate {
private Dialog createNotAgainDialog() private Dialog createNotAgainDialog()
{ {
DialogInterface.OnClickListener lstnr_p = Dialog dialog = null;
new DialogInterface.OnClickListener() { if ( 0 != m_msgID ) {
public void onClick( DialogInterface dlg, int item ) { DialogInterface.OnClickListener lstnr_p =
if ( null != m_proc ) { new DialogInterface.OnClickListener() {
m_proc.run(); public void onClick( DialogInterface dlg, int item ) {
if ( null != m_proc ) {
m_proc.run();
}
} }
} };
};
DialogInterface.OnClickListener lstnr_n = DialogInterface.OnClickListener lstnr_n =
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dlg, int item ) { public void onClick( DialogInterface dlg, int item ) {
CommonPrefs.setPrefsBoolean( m_activity, m_prefsKey, true ); CommonPrefs.setPrefsBoolean( m_activity, m_prefsKey,
if ( null != m_proc ) { true );
m_proc.run(); if ( null != m_proc ) {
m_proc.run();
}
} }
} };
};
return new AlertDialog.Builder( m_activity ) dialog = new AlertDialog.Builder( m_activity )
.setTitle( R.string.newbie_title ) .setTitle( R.string.newbie_title )
.setMessage( m_msgID ) .setMessage( m_msgID )
.setPositiveButton( R.string.button_ok, lstnr_p ) .setPositiveButton( R.string.button_ok, lstnr_p )
.setNegativeButton( R.string.button_notagain, lstnr_n ) .setNegativeButton( R.string.button_notagain, lstnr_n )
.create(); .create();
}
return dialog;
} // createNotAgainDialog } // createNotAgainDialog
private Dialog createConfirmThenDialog() private Dialog createConfirmThenDialog()