@Override public View getHeaderView(int position, View convertView, ViewGroup parent) { HeaderViewHolder holder; Cursor cursor = null; if (getCursor().getCount() > ConstsCore.ZERO_INT_VALUE) { cursor = (Cursor) getItem(position); } if (convertView == null) { holder = new HeaderViewHolder(); convertView = layoutInflater.inflate(R.layout.list_item_chat_sticky_header_date, parent, false); holder.headerTextView = (TextView) convertView.findViewById(R.id.header_date_textview); convertView.setTag(holder); } else { holder = (HeaderViewHolder) convertView.getTag(); } if (cursor != null) { long time = cursor.getLong(cursor.getColumnIndex(MessageTable.Cols.TIME)); holder.headerTextView.setText(DateUtils.longToMessageListHeaderDate(time)); } return convertView; }
@Override public View getHeaderView(int position, View convertView, ViewGroup viewGroup) { HeaderViewHolder holder; if (convertView == null) { holder = new HeaderViewHolder(); convertView = mLayoutInflater.inflate(mHeaderLayoutResId, null); holder.headerTextView = (TextView) convertView.findViewById(R.id.title); convertView.setTag(holder); } else { holder = (HeaderViewHolder) convertView.getTag(); } // Check if this item falls within the subject or course list to determine header if (position < mSubjectSection.size()) { holder.headerTextView.setText(R.string.soc_sub_header); } else { holder.headerTextView.setText(R.string.soc_course_header); } return convertView; }