How to Convert Firebase data to Java Object…?

后端 未结 5 1074
独厮守ぢ
独厮守ぢ 2020-11-27 12:12

Using Firebase Library to send data to the server in the form Message(String, String) added to the HashMap

Exampl

5条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 12:22

    So if you wanna get the messages you can do the following:

            for (DataSnapshot child : dataSnapshot.getChildren()){
        //child is each element in the finished list
        Map message = (Map)child.getValue();
        Message msg = new Message((String) message.getValue().get("message"),
                (String) message.get("name"));
    }
    

提交回复
热议问题