Fixed a memory leak in the bluetooth settings

Release resources in onPause rather than onResume to fix a memory leak.
Without this fix the app will crash if you are in Bluetooth settings
and tap "Device name" and then roate the device a few times.

Change-Id: I57a8346247c13f5113e7c4ea39dde5b29a7359bb
This commit is contained in:
Gustaf Nilklint
2011-01-04 07:56:45 +01:00
committed by Johan Redestig
parent e8531ff6a0
commit 00fa2f578e

View File

@@ -161,8 +161,6 @@ public class BluetoothSettings extends PreferenceActivity
// Repopulate (which isn't too bad since it's cached in the settings
// bluetooth manager
mDevicePreferenceMap.clear();
mDeviceList.removeAll();
addDevices();
if (mScreenType == SCREEN_TYPE_SETTINGS) {
@@ -187,6 +185,9 @@ public class BluetoothSettings extends PreferenceActivity
protected void onPause() {
super.onPause();
mDevicePreferenceMap.clear();
mDeviceList.removeAll();
mLocalManager.setForegroundActivity(null);
mDevicePreferenceMap.clear();
mDeviceList.removeAll();