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,6 +179,8 @@ public class DlgDelegate {
private Dialog createNotAgainDialog() private Dialog createNotAgainDialog()
{ {
Dialog dialog = null;
if ( 0 != m_msgID ) {
DialogInterface.OnClickListener lstnr_p = DialogInterface.OnClickListener lstnr_p =
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dlg, int item ) { public void onClick( DialogInterface dlg, int item ) {
@ -191,19 +193,22 @@ public class DlgDelegate {
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,
true );
if ( null != m_proc ) { if ( null != m_proc ) {
m_proc.run(); 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()