我如何读取特定用户的相关数据

时间:2020-01-21 10:28:45

标签: android firebase firebase-realtime-database

enter image description here

问题。如何在using System; using System.IO; using System.Xml.Serialization; [XmlRoot(ElementName = "result")] public class Result { [XmlElement(ElementName = "fwdRate")] public double FwdRate { get; set; } } public class Program { public static void Main() { string val = "<result><fwdRate>-9.72316862724032E-05</fwdRate></result>"; Result response = ParseXML(val); Console.WriteLine(response.FwdRate); } static Result ParseXML(string value) { XmlSerializer serializer = new XmlSerializer(typeof(Result)); using (TextReader reader = new StringReader(value)) { return serializer.Deserialize(reader) as Result; } } } 下的数据顺序上获取数据? vpk1lxv7ZHY7KbOJ4l5Bl4KOBKJ3 double > 08-11-karpetyogadwisaputra08213838686868yogadwisaputra1-27 吗?

decimal

我这样尝试,但数据始终为空。请帮助

(我从 datauser 获得了用户ID idorder

enter image description here

更新 请求的 idorder 输出

userId
使用数据用户

上的idorder idorder

screnshot输出

[3]: https://i.stack.imgur.com/5Ai0I.jpg

1 个答案:

答案 0 :(得分:0)

尝试一下,这就是我的工作方式

 @Override
        public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
            dataOrder dataorder = dataSnapshot.getValue(dataOrder.class);
            if (dataorder != null) {
            status.setText("jadwal anda= "+ dataorder.haritanggalOrder + "....."); 
        }