summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/bluetooth')
-rw-r--r--src/com/android/settings/bluetooth/BluetoothSettings.java3
-rw-r--r--src/com/android/settings/bluetooth/CachedBluetoothDevice.java31
2 files changed, 27 insertions, 7 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 1e73b2d..78c531c 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -188,7 +188,8 @@ public class BluetoothSettings extends PreferenceActivity
super.onPause();
mLocalManager.setForegroundActivity(null);
-
+ mDevicePreferenceMap.clear();
+ mDeviceList.removeAll();
unregisterReceiver(mReceiver);
mLocalManager.unregisterCallback(this);
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index 48fd85d..b78427b 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -67,6 +67,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
private final LocalBluetoothManager mLocalManager;
+ private AlertDialog mDialog = null;
+
private List<Callback> mCallbacks = new ArrayList<Callback>();
/**
@@ -199,12 +201,29 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
}
};
- new AlertDialog.Builder(context)
- .setTitle(getName())
- .setMessage(message)
- .setPositiveButton(android.R.string.ok, disconnectListener)
- .setNegativeButton(android.R.string.cancel, null)
- .show();
+ if (mDialog == null) {
+ mDialog = new AlertDialog.Builder(context)
+ .setPositiveButton(android.R.string.ok, disconnectListener)
+ .setNegativeButton(android.R.string.cancel, null)
+ .create();
+ } else {
+ if (mDialog.isShowing()) {
+ mDialog.dismiss();
+ }
+ }
+ mDialog.setTitle(getName());
+ mDialog.setMessage(message);
+ mDialog.show();
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ if (mDialog != null) {
+ mDialog.dismiss();
+ mDialog = null;
+ }
+
+ super.finalize();
}
public void connect() {