如何在自定义列表适配器中使用以下代码将列表项与日期(已创建字段)分开?中的节标题?
这是我的自定义适配器代码
private class MyCustomAdapter extends ArrayAdapter<ReportItem>
{
private ArrayList<ReportItem> stateList;
public MyCustomAdapter(Context context, int textViewResourceId,ArrayList<ReportItem> stateList)
{
super(context, textViewResourceId, stateList);
this.stateList = new ArrayList<ReportItem>();
this.stateList.addAll(stateList);
}
private class ViewHolder
{
TextView title;
TextView city;
TextView category;
TextView created;
TextView tags;
}
@SuppressLint("InflateParams")
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
ViewHolder holder = null;
Log.v("ConvertView", String.valueOf(position));
if (convertView == null)
{
LayoutInflater vi = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = vi.inflate(R.layout.reports_list_item, null);
holder = new ViewHolder();
holder.title = (TextView) convertView.findViewById(R.id.textView1);
holder.city = (TextView) convertView.findViewById(R.id.textView2);
holder.category = (TextView) convertView.findViewById(R.id.textView3);
holder.created = (TextView) convertView.findViewById(R.id.textView4);
holder.tags = (TextView) convertView.findViewById(R.id.textView5);
convertView.setTag(holder);
}
else
{
holder = (ViewHolder) convertView.getTag();
}
ReportItem county_obj = reportsListO.get(position);
holder.title.setText(removeSpecialChars(county_obj.getTitleP()));
holder.city.setText(removeSpecialChars(county_obj.getCity()));
holder.category.setText(removeSpecialChars(county_obj.getCategoryP()));
holder.created.setText(editTimeFormat(county_obj.getCreatedP()));
holder.tags.setText(removeSpecialChars(county_obj.getTags()));
return convertView;
}
}