java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getImportantForAccessibility()' on a null object reference
getView()方法返回null,会造成这个异常
改成convertView就行
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = LayoutInflater.from(singleChoiceActivity).inflate(R.layout.single_item,null); holder = new ViewHolder(); holder.tv_data = (TextView) convertView.findViewById(R.id.tv_data); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.tv_data.setText(datas.get(position)); return convertView; } static class ViewHolder { TextView tv_data; }