summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorjhtop.kim <jhtop.kim@samsung.com>2011-07-19 20:25:02 +0900
committerJake Hamby <jhamby@google.com>2011-07-25 16:22:43 -0700
commitbb16e15de32f14c25728db39494c0cff9b80d186 (patch)
tree0bff9e950f3eb391551f6a411985cc574c37823b /src/com
parentb55738841b2a9e53bb6873bd4d5fb133f8dc099c (diff)
downloadpackages_apps_settings-bb16e15de32f14c25728db39494c0cff9b80d186.zip
packages_apps_settings-bb16e15de32f14c25728db39494c0cff9b80d186.tar.gz
packages_apps_settings-bb16e15de32f14c25728db39494c0cff9b80d186.tar.bz2
Bluetooth : fix for crashing alertDialogbox
- changes for crashing of alertDialogbox while displaying message - in showError function, this fix code shoud be added in case of showing error pop up Bug: 5068089 Change-Id: I40e8a699461832b7bd47080b40f467572632d412 Signed-off-by: jhtop.kim <jhtop.kim@samsung.com>
Diffstat (limited to 'src/com')
-rwxr-xr-x[-rw-r--r--]src/com/android/settings/bluetooth/LocalBluetoothManager.java4
-rwxr-xr-x[-rw-r--r--]src/com/android/settings/bluetooth/Utils.java8
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();
+ }
}
}