diff options
author | Jake Hamby <jhamby@google.com> | 2011-07-25 17:21:58 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-25 17:21:58 -0700 |
commit | 2837fbbe159f2572ea5825022d6defdbf1414e3f (patch) | |
tree | 6627f554c82e4808d992f8d096876594abea2533 /src/com | |
parent | ddf71724fd042a7d1b794fc676dd463b387de355 (diff) | |
parent | bb16e15de32f14c25728db39494c0cff9b80d186 (diff) | |
download | packages_apps_settings-2837fbbe159f2572ea5825022d6defdbf1414e3f.zip packages_apps_settings-2837fbbe159f2572ea5825022d6defdbf1414e3f.tar.gz packages_apps_settings-2837fbbe159f2572ea5825022d6defdbf1414e3f.tar.bz2 |
Merge "Bluetooth : fix for crashing alertDialogbox"
Diffstat (limited to 'src/com')
-rwxr-xr-x[-rw-r--r--] | src/com/android/settings/bluetooth/LocalBluetoothManager.java | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | src/com/android/settings/bluetooth/Utils.java | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothManager.java b/src/com/android/settings/bluetooth/LocalBluetoothManager.java index 63b8b7c..a1edca1 100644..100755 --- a/src/com/android/settings/bluetooth/LocalBluetoothManager.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothManager.java @@ -79,6 +79,10 @@ public final class LocalBluetoothManager { return mContext; } + public Context getForegroundActivity() { + return mForegroundActivity; + } + boolean isForegroundActivity() { return mForegroundActivity != null; } diff --git a/src/com/android/settings/bluetooth/Utils.java b/src/com/android/settings/bluetooth/Utils.java index 7d38e17..01e72e0 100644..100755 --- a/src/com/android/settings/bluetooth/Utils.java +++ b/src/com/android/settings/bluetooth/Utils.java @@ -89,11 +89,17 @@ final class Utils { static void showError(Context context, String name, int messageResId) { String message = context.getString(messageResId, name); - new AlertDialog.Builder(context) + LocalBluetoothManager manager = LocalBluetoothManager.getInstance(context); + Context activity = manager.getForegroundActivity(); + if(manager.isForegroundActivity()) { + new AlertDialog.Builder(activity) .setIcon(android.R.drawable.ic_dialog_alert) .setTitle(R.string.bluetooth_error_title) .setMessage(message) .setPositiveButton(android.R.string.ok, null) .show(); + } else { + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); + } } } |