diff options
Diffstat (limited to 'src/com/android/settings/SettingsSafetyLegalActivity.java')
-rw-r--r-- | src/com/android/settings/SettingsSafetyLegalActivity.java | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/com/android/settings/SettingsSafetyLegalActivity.java b/src/com/android/settings/SettingsSafetyLegalActivity.java index 0c51928..368ee1d 100644 --- a/src/com/android/settings/SettingsSafetyLegalActivity.java +++ b/src/com/android/settings/SettingsSafetyLegalActivity.java @@ -40,6 +40,8 @@ public class SettingsSafetyLegalActivity extends AlertActivity private WebView mWebView; + private AlertDialog mErrorDialog = null; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -85,14 +87,31 @@ public class SettingsSafetyLegalActivity extends AlertActivity } private void showErrorAndFinish(String url) { - new AlertDialog.Builder(this) - .setMessage(getResources() - .getString(R.string.settings_safetylegal_activity_unreachable, url)) - .setTitle(R.string.settings_safetylegal_activity_title) - .setPositiveButton(android.R.string.ok, this) - .setOnCancelListener(this) - .setCancelable(true) - .show(); + if (mErrorDialog == null) { + mErrorDialog = new AlertDialog.Builder(this) + .setTitle(R.string.settings_safetylegal_activity_title) + .setPositiveButton(android.R.string.ok, this) + .setOnCancelListener(this) + .setCancelable(true) + .create(); + } else { + if (mErrorDialog.isShowing()) { + mErrorDialog.dismiss(); + } + } + mErrorDialog.setMessage(getResources() + .getString(R.string.settings_safetylegal_activity_unreachable, url)); + mErrorDialog.show(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + + if (mErrorDialog != null) { + mErrorDialog.dismiss(); + mErrorDialog = null; + } } @Override |