@Override
public View getView(int position, View convertView, ViewGroup parent) {
View newView = convertView;
DayHolder holder;
Integer curr = (Integer) theList.get(position);
if (null == convertView){
holder = new DayHolder();
newView = mInflater.inflate(R.layout.activity_select_day,null);
holder.mText = (TextView) newView.findViewById(R.id.selectDays);
}else{
holder = (DayHolder) newView.getTag();
}
holder.mText.setText(curr.toString());
return newView;
}
2nd, if you call getTag()
, you should be calling setTag()
. You are not; hence, your getTag()
call will always return null
. Call newView.setTag(holder)
in your if
block, after having created your holder
instance.
AFTER CORRECTION
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View newView = convertView;
DayHolder holder;
Integer curr = (Integer) theList.get(position);
if (null == convertView){
holder = new DayHolder();
newView = mInflater.inflate(R.layout.activity_select_day, parent, false);
holder.mText = (TextView) newView.findViewById(R.id.selectDays);
newView.setTag(holder);
}else{
holder = (DayHolder) newView.getTag();
}
holder.mText.setText(curr.toString());
return newView;
}
0 comments:
Post a Comment