Check if the Activity is finishing before showDialog()

Check if the Activity is going through its finishing phase before
displaying the Dialog, because Showing dialog once the activity
is no longer in context will cause BadTokenException.

Change-Id: I58940e694f61cd79536abe2df60a0b745a7b806f
This commit is contained in:
Tony Guo
2012-06-27 10:58:04 +08:00
committed by Henrik Baard
parent f141594c05
commit 63c91f0973

View File

@@ -112,7 +112,8 @@ public class AccountSyncSettings extends AccountPreferenceBase {
} catch (AuthenticatorException e) {
// handled below
}
if (failed) {
if (failed && getActivity() != null &&
!getActivity().isFinishing()) {
showDialog(FAILED_REMOVAL_DIALOG);
} else {
finish();