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
TextView initialization is wrong
if(convertView == null){
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(layoutResourceId, parent, false);
mHolder = new ViewHolder();
****** RETURNS NULL DURING DEBUGGING ******
mHolder.textViewCenter = (TextView) convertView .findViewById(R.id.textview_list_item_central); //Change done
convertView.setTag(mHolder);
}else{
mHolder = (ViewHolder) convertView.getTag();
}
You are inflating the layout, but not using it while fetching it's views
Do this:
mHolder.textViewCenter = (TextView)convertView.findViewById(R.id.textview_list_item_central)
Search for the views in the convertView
that you inflate(and not in the current Activity
layout like you currently do):
mHolder.textViewCenter = (TextView)
convertView.findViewById(R.id.textview_list_item_central);
try replacing this:
convertView = inflater.inflate(R.layout.listitemview, null);
where listitemview
is your xml
in which you defined your ImageView
and TextView
s..
hope this helps you
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);