Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android不工作的情况下读取firebase数据库_Android_Firebase_Firebase Realtime Database - Fatal编程技术网

在android不工作的情况下读取firebase数据库

在android不工作的情况下读取firebase数据库,android,firebase,firebase-realtime-database,Android,Firebase,Firebase Realtime Database,每当我试图从这个数据库读取数据时,它都返回空值。您可以在图片中看到,它在数据库中不是空的。我一直在寻找关于这方面的好文档,但我不相信它的存在,我只需要它返回一个字符串或int值为58的dose,这样我就可以在我的活动中显示它 您的代码不起作用,因为“剂量”的数据类型是整数。您需要使用整数,而不是转换为字符串 String Value = dataSnapshot.child(pName).child("dose").getValue(Integer.class); 谢谢你的帮助,但它仍然返回

每当我试图从这个数据库读取数据时,它都返回空值。您可以在图片中看到,它在数据库中不是空的。我一直在寻找关于这方面的好文档,但我不相信它的存在,我只需要它返回一个字符串或int值为58的dose,这样我就可以在我的活动中显示它


您的代码不起作用,因为“剂量”的数据类型是整数。您需要使用整数,而不是转换为字符串

String Value = dataSnapshot.child(pName).child("dose").getValue(Integer.class);

谢谢你的帮助,但它仍然返回空值
String Value = dataSnapshot.child(pName).child("dose").getValue(Integer.class);