Skip to content

Instantly share code, notes, and snippets.

@yusufcakal
Created January 20, 2018 00:50
Show Gist options
  • Save yusufcakal/7958f0ab318b72c0e197a9c6bf9a0d74 to your computer and use it in GitHub Desktop.
Save yusufcakal/7958f0ab318b72c0e197a9c6bf9a0d74 to your computer and use it in GitHub Desktop.
Firebase
ValueEventListener postListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Iterable<DataSnapshot> snapshot = dataSnapshot.child("book").getChildren();
for (DataSnapshot snapshot1 : snapshot) {
Book book = snapshot1.getValue(Book.class);
tvData.setText(book.getName());
}
//tvData.setText(book.getName()); Textview e datayı bind ettik.
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
mDatabase.addValueEventListener(postListener);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment