Android: listview: custom items: nullpointerexception, findviewbyid returns null

前端 未结 5 2258
耶瑟儿~
耶瑟儿~ 2020-12-11 14:27

I have been googling and searching to resolve this error for some time and I can`t seem to find out why and how to solve it.

I`m using a customAdapter to fill in my

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-11 15:01

    change the line

    mHolder.textViewCenter = (TextView)findViewById(R.id.textview_list_item_central);
    

    which is below * RETURNS NULL DURING DEBUGGING * by

    mHolder.textViewCenter = (TextView) convertView.findViewById(R.id.textview_list_item_central);
    

提交回复
热议问题