更新时间:2022-12-08 21:31:09
onChildAdded()
仅在添加了新的子项或已有子项时被调用.
onChildAdded()
will only be called when a new child has been added or a child already exist.
在您的情况下,您没有添加任何子代,因此永远不会调用onChildAdded()
.这就是 progressDialog不断无限加载
In your case, you don't have any child added, So onChildAdded()
is never been called. that's why progressDialog keeps loading infinitely
要检测是否存在子代,请使用ValueEventListener
而不是ChildEventListener
.这是链接如何使用ValueEventListener
To detect if a child exists, use ValueEventListener
instead of ChildEventListener
. Here is link how to use ValueEventListener