Created
December 24, 2019 11:29
-
-
Save sidishere/52dff6533ddc544fa2fff3af36789274 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
smartAC.addValueEventListener(new ValueEventListener() { | |
boolean firstTime=true; | |
@Override | |
public void onDataChange(DataSnapshot dataSnapshot) { | |
// This method is called once with the initial value and again | |
// whenever data at this location is updated. | |
String value = dataSnapshot.getValue(String.class); | |
textView1.setText("smartAC " + value); | |
if(firstTime) { | |
if (value.equals( "ON")) { | |
s4.setChecked(true); | |
s1.setChecked(true); | |
firstTime = false; | |
} else { | |
s1.setChecked(false); | |
firstTime = false; | |
} | |
} | |
} | |
@Override | |
public void onCancelled(DatabaseError error) { | |
// Failed to read value | |
Log.w("file", "Failed to read value.", error.toException()); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment