Showing Error :Attempt to invoke interface method 'int java.util.List.size()' on a null object reference

前端 未结 3 913
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-19 20:42

I\'m creating an app that display contact list in a listview.The problem is I\'m getting the following error when I run my app and I\'m struggling to fix it:



        
3条回答
  •  长情又很酷
    2020-12-19 21:18

    Extract this line

    List contactModelList = new ArrayList<>();
    

    before the try block and instead of return null; use return contactModelList;

    Looks like your parsing fails and you pass a null object to onPostExecute().

提交回复
热议问题