0
次のコード例を考える:onChildAddedイベントが発生したときにFirebaseの親アイテムを取得する方法は?
// Get a reference to our posts
Firebase ref = new Firebase("https://docs-examples.firebaseio.com/web/saving-data/fireblog/posts");
ref.addChildEventListener(new ChildEventListener() {
// Retrieve new posts as they are added to the database
@Override
public void onChildAdded(DataSnapshot snapshot, String previousChildKey) {
BlogPost newPost = snapshot.getValue(BlogPost.class);
System.out.println("Author: " + newPost.getAuthor());
System.out.println("Title: " + newPost.getTitle());
}
//... ChildEventListener also defines onChildChanged, onChildRemoved,
// onChildMoved and onCanceled, covered in later sections.
});
それはonChildAddedがトリガされたときFirebaseにDataSnapshotの親アイテムを取得することはできますか?