@Override public View getView(int position, View convertView, ViewGroup parent) { holder = null; if (null == convertView) { holder = new ViewHolder(); if (null == mInflater) { mInflater = LayoutInflater.from(MainActivity.instance); } convertView = mInflater.inflate(R.layout.unit_supplies, null, false); holder.tvTitle = (TextView) convertView.findViewById(R.id.supplies_unit_title); holder.tvValue = (TextView) convertView.findViewById(R.id.supplies_unit_value); holder.tvGrowth = (TextView) convertView.findViewById(R.id.supplies_unit_growth); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Pair pair = (Pair) getItem(position); holder.tvTitle.setText(pair.getTitle()); holder.tvValue.setText(Strs.f(pair.getValue())); holder.tvGrowth.setText(Strs.f(pair.getGrowth())); return convertView; }
public void onItemClick(Pair pair, int position) { tvSelect.setText(pair.getTitle()); lnSelectBuy.setPair(pair); selectPosition = position; }