我刚开始使用firebase,我有这样的数据视图。
我像这样观察/查询 con-LD-iQlmxyvo2t3mvwER 。
private void retrieveConversation(String conversationID) {
Query queryRoom = FirebaseDatabase.getInstance().getReference().child("Conversation").child(conversationID);
queryRoom.keepSynced(true);
queryRoom.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Conversation conversation = dataSnapshot.getValue(Conversation.class);
if (conversation != null) {
conversation = updateConversation(conversation);
mainMessage.conversations.put(conversation.getId(), conversation);
EventBus.getDefault().post(new ChatAdapter.AddMessage());
EventBus.getDefault().post(new ChatDetailAdapter.ReceiveMessage());
if (chatDetailBlock != null) {
if (conversation.getId().equals(chatDetailID)) {
chatDetailBlock.run();
chatDetailBlock = null;
chatDetailID = null;
}
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
问题是我需要忽略" 消息"子节点,监听/观察其余节点并更新对象(或至少限制消息数量)。有可能吗?