Last active
April 9, 2017 03:29
-
-
Save ramadani/e3f4f96f339f623859f04d985b947959 to your computer and use it in GitHub Desktop.
Simple Android App using Firebase Realtime Database - ValueEventListener
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
ValueEventListener valueEventListener = new ValueEventListener() { | |
@Override | |
public void onDataChange(DataSnapshot dataSnapshot) { | |
ArrayList<Note> notes = new ArrayList<Note>(); | |
for (DataSnapshot noteSnapshot: dataSnapshot.getChildren()) { | |
Note note = noteSnapshot.getValue(Note.class); | |
notes.add(note); | |
} | |
notesView.refreshNoteList(notes); | |
} | |
@Override | |
public void onCancelled(DatabaseError databaseError) { | |
Log.w(TAG, "loadNote:onCancelled", databaseError.toException()); | |
} | |
}; | |
mNoteRef.orderByKey().addValueEventListener(valueEventListener); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment