From c009b8a4961451c3ab2d9fecb8c4559adc55425d Mon Sep 17 00:00:00 2001 From: PauloftheWest Date: Tue, 9 Sep 2014 10:04:46 -0700 Subject: [PATCH] Fixed a Null Pointer Error in Bluetooth Settings. + The root of the problem is that the callback for a device change may be set before the fragment has a layout. Then if a change does come in, getView() would return null. This fix delays registering the callback until appropiate. Bug: 17404518 Change-Id: Ibd0e90f82593d45729f427bcc2e40fe9195eb42a --- src/com/android/settings/bluetooth/DeviceProfilesSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java index 110432bdd1e..ee25300da9f 100755 --- a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java +++ b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java @@ -132,8 +132,8 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment public void setDevice(CachedBluetoothDevice cachedDevice) { mCachedDevice = cachedDevice; - mCachedDevice.registerCallback(this); if (isResumed()) { + mCachedDevice.registerCallback(this); addPreferencesForProfiles(); refresh(); }