@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = inflater.inflate(R.layout.schedule_calendar_selection_item, null); viewHolder = new ViewHolder(); viewHolder.name = (TextView) convertView.findViewById(R.id.calendar_name_text); viewHolder.desc = (TextView) convertView.findViewById(R.id.calendar_desc_text); viewHolder.icon = (ImageView) convertView.findViewById(R.id.select_icon); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } Calendar365 item = getItem(position); viewHolder.name.setText(item.getTitle()); if ("google".equals(item.getDataDomain())) { viewHolder.desc.setText("谷歌日历"); } else { viewHolder.desc.setText("365日历"); } if (item.getId() == calendarID) { viewHolder.icon.setImageResource(R.drawable.schedule_calendar_selected); } else { viewHolder.icon.setImageResource(R.drawable.schedule_calendar_unselect); } return convertView; }
private void update(Calendar365 calendar365) { calendarNameTextView.setText(calendar365.getTitle()); if ("google".equals(calendar365.getDataDomain())) { calendarDescTextView.setText("谷歌日历"); } else { calendarDescTextView.setText("365日历"); } }