dataSnapshot has the object but getValue() will return null

前端 未结 2 1737
离开以前
离开以前 2021-01-21 04:27

So I\'m struggling with this issue for about three hours now.
I have this user class

public class User {
private String user_id;
private String userNa         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-01-21 04:48

    You need to iterate over dataSnapshot.getChildren(...for example

                    for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) {
                        User user = childSnapshot.getValue(User.class);
                     }
    

提交回复
热议问题