小编Auf*_*sen的帖子

Firebase"反序列化时映射,但得到类java.util.ArrayList"

我只是在Android上为我的项目尝试Firebase.

我得到的问题是,每次拍摄快照并将其"投"回POJO我都会得到这个 -

"反序列化时映射,但得到了一个类java.util.ArrayList"异常.

我一直在环顾四周,甚至改变我所有的模型使用HashMap而没有任何ArrayList结果,仍然得到相同的结果.

这是我的模特:

  public class DevicesController {

        public DevicesCollection devices;
        public int numberOfport;
        String timerStatus;

        public DevicesController(){

            devices = new DevicesCollection();
            timerStatus = "UPDATED";
        }

        public DevicesController(int numberOfport){
            devices = new DevicesCollection();
            this.numberOfport = numberOfport;
            timerStatus = "UPDATED";
        }



        public ArrayList<Integer> getCurrentState(String in){
            ArrayList<Integer> currentState = new ArrayList<Integer>();
            for(int i = 0; i < numberOfport; i++){
                currentState.add(0);
            }
            Iterator it = this.getDevices().getAllDevices().entrySet().iterator();
            while (it.hasNext()) {
                Map.Entry pair = (Map.Entry) …
Run Code Online (Sandbox Code Playgroud)

java android json pojo firebase-realtime-database

6
推荐指数
1
解决办法
7670
查看次数

标签 统计

android ×1

firebase-realtime-database ×1

java ×1

json ×1

pojo ×1