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

前端 未结 3 907
佛祖请我去吃肉
佛祖请我去吃肉 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条回答
  •  梦毁少年i
    2020-12-19 21:20

    The List object which you passed into the adapter is null. So when the adapter calls list.Size(), a null pointer exception is thrown.

    Use a debugger, set a breakpoint somewhere around com.kksworld.jsonparsing.MainActivity$JSONTask.onPostExecute(MainActivity.java:48), and work your way backward from there if you can't figure it out.

    One assumes that your json parse failed somehow or another.

提交回复
热议问题