@@ -93,7 +93,6 @@ protected void onCreate(Bundle savedInstanceState) {
93
93
94
94
phHueSDK = PHHueSDK .getInstance ();
95
95
bridge = phHueSDK .getSelectedBridge ();
96
- lights = bridge .getResourceCache ().getAllLights ();
97
96
getLightNames ();
98
97
99
98
TextView tvLight = (TextView ) findViewById (R .id .tvLight );
@@ -255,6 +254,7 @@ private void displayLastKnowLightState(PHLightState lastKnownLightState) {
255
254
* Reads light names and stores in common container
256
255
*/
257
256
private void getLightNames () {
257
+ lights = bridge .getResourceCache ().getAllLights ();
258
258
int size = lights .size ();
259
259
lightArray = new String [size ];
260
260
for (int i = 0 ; i < size ; i ++) {
@@ -428,6 +428,7 @@ public void onClick(View v) {
428
428
break ;
429
429
}
430
430
int pos = lightSpinner .getSelectedItemPosition ();
431
+ lights = bridge .getResourceCache ().getAllLights ();
431
432
PHLight light = lights .get (pos );
432
433
if (tbGamutCorrection .isChecked ()) {
433
434
xy = PHUtilities .calculateXY (colorCode , light .getModelNumber ());
@@ -568,6 +569,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
568
569
569
570
case R .id .read_cache :
570
571
int pos = lightSpinner .getSelectedItemPosition ();
572
+ lights = bridge .getResourceCache ().getAllLights ();
571
573
PHLight light = lights .get (pos );
572
574
PHLightState lastKnownLightState = light .getLastKnownLightState ();
573
575
displayLastKnowLightState (lastKnownLightState );
@@ -597,6 +599,7 @@ private void setLightState() {
597
599
*/
598
600
private void updateLightState () {
599
601
int pos = lightSpinner .getSelectedItemPosition ();
602
+ lights = bridge .getResourceCache ().getAllLights ();
600
603
PHLight light = lights .get (pos );
601
604
PHLightState state = getCurrentLightState ();
602
605
final PHWizardAlertDialog dialogManager = PHWizardAlertDialog
0 commit comments