Skip to content

Instantly share code, notes, and snippets.

@gonzalonm
Created October 5, 2017 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gonzalonm/e049baa6b40c38e336a039638a9d198f to your computer and use it in GitHub Desktop.
Save gonzalonm/e049baa6b40c38e336a039638a9d198f to your computer and use it in GitHub Desktop.
// Read from the database
myRef.addValueEventListener(new ValueEventListener() {
@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);
Log.d(TAG, "Value is: " + value);
}
@Override
public void onCancelled(DatabaseError error) {
// Failed to read value
Log.w(TAG, "Failed to read value.", error.toException());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment