当前位置: 首页 > 工具软件 > InterfaceM > 使用案例 >

Caused by: java.lang.NullPointerException: Attempt to invoke interface method

燕文昌
2023-12-01

很明显是一个空指针报错,代码如下:

 private List<EQ_Fault> mUsers;
 EQ_Fault eq_fault1 = new EQ_Fault("1","111","a","b","c","d",true);
        EQ_Fault eq_fault2 = new EQ_Fault("1","111","a","b","c","d",true);
        EQ_Fault eq_fault3 = new EQ_Fault("1","111","a","b","c","d",true);
        EQ_Fault eq_fault4 = new EQ_Fault("1","111","a","b","c","d",true);
        EQ_Fault eq_fault5 = new EQ_Fault("1","111","a","b","c","d",true);
        mUsers.add(eq_fault1);
        mUsers.add(eq_fault2);
        mUsers.add(eq_fault3);
        mUsers.add(eq_fault4);
        mUsers.add(eq_fault5);

所以是哪里出问题了呢,经检查发现,是list数组没有经过初始化。我们只需把一下代码加上即可!

mUsers = new ArrayList<>();
 类似资料:

相关阅读

相关文章

相关问答