gpt4 book ai didi

java - 为什么我的应用程序无法从 Firebase 捕获任何数据?

转载 作者:行者123 更新时间:2023-12-01 19:35:39 27 4
gpt4 key购买 nike

我正在处理登录屏幕。

但是,当我在填写ID和pw后运行代码时,userId(下面的代码)仍然为空。

foundUser = dataSnapshot.getValue(User.class);
userId = foundUser.getId();
userPw = foundUser.getPw();

我的应用程序确实已连接到 Firebase。但是,当我调试代码时,我可以看到 W/ClassMapper:在类 com.example.hellobook.User 上找不到 exampleuserID 的 setter /字段

最佳答案

这不应该吗

for (DataSnapshot ds : dataSnapshot.getChildren()) { 
foundUser = dataSnapshot.getValue(User.class);

for (DataSnapshot ds : dataSnapshot.getChildren()) { 
foundUser = ds.getValue(User.class);

关于java - 为什么我的应用程序无法从 Firebase 捕获任何数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57709526/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com