Skip to content

Instantly share code, notes, and snippets.

@yusufcakal
Created January 19, 2018 23:53
Show Gist options
  • Save yusufcakal/1dee3c91bdf1983fb1dd6e4ff37cbaf6 to your computer and use it in GitHub Desktop.
Save yusufcakal/1dee3c91bdf1983fb1dd6e4ff37cbaf6 to your computer and use it in GitHub Desktop.
Firebase
public class FirebaseUtil {
public static void saveData(){
List<Author> authorList = new ArrayList<>();
Author author1 = new Author("Robert C. Martin");
authorList.add(author1);
Book book = new Book("Clean Code", authorList);
DatabaseReference database = FirebaseDatabase.getInstance().getReference();
DatabaseReference databaseBook = database.child("book");
databaseBook.push().setValue(book);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment