请问空指针异常是怎么回事
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { View view = inflater.inflate(R.layout.item,null); holder = new ViewHolder(); holder.item_content = (TextView) view.findViewById(R.id.item_content); holder.item_title = (TextView) view.findViewById(R.id.item_title); holder.item_icon = (ImageView) view.findViewById(R.id.item_icon); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.item_icon.setImageResource(R.mipmap.ic_launcher); holder.item_title.setText(mListData.get(position).newsTitle); holder.item_content.setText(mListData.get(position).newsContent); return convertView; }
java.lang.NullPointerException
at com.jeff.asynctaskdemo2.NewsAdapter.getView(NewsAdapter.java:50)
也就是 convertView.setTag(holder); 这里报错了