示例#1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    Cache cache;

    if (convertView == null) {
      convertView = LayoutInflater.from(context).inflate(R.layout.item_horas_forecast, null);
      cache = new Cache();
      cache.tvHora = (TextView) convertView.findViewById(R.id.tvHora);
      cache.ivIconoHora = (ImageView) convertView.findViewById(R.id.ivIconoHora);
      cache.tvResumen = (TextView) convertView.findViewById(R.id.tvResumenHora);
      cache.tvTemperatura = (TextView) convertView.findViewById(R.id.tvTemperaturaHora);

      convertView.setTag(cache);
    } else {
      cache = (Cache) convertView.getTag();
    }

    Hora hora = horas[position];
    cache.tvHora.setText(hora.obtenerHora());
    cache.ivIconoHora.setImageResource(hora.getImagenId());
    cache.tvResumen.setText(hora.getResumen());
    cache.tvTemperatura.setText(hora.getTemperatura() + "");

    return convertView;
  }