no edit summary
As configured, any changes that take place in the tree beneath the /test/data level will trigger a call to the onDataChange() method of the change event listener. The data snapshot passed to this method will contain the entire subtree located beneath the /test/data node.
In addition to the values, the above code makes use of the getKey() method to display the keys for the two immediate children in the example tree (i.e. message1 and message2). Because each element returned by the getChildren() method is itself a DataSnapshot instance, code can be written to recursively call the getChildren() method on each child to eventually extract keys and values from the entire snapshot tree.
== Reading Data into a Java Object ==