Buenas, como te he dicho, necesitas un adapter:
Código Java:
Ver originalpublic class AndroidVersion {
int logo;
int logo) {
super();
this.nombre = nombre;
this.version = version;
this.logo = logo;
}
return version;
}
public void setVersion
(String version
) { this.version = version;
}
return nombre;
}
public void setNombre
(String nombre
) { this.nombre = nombre;
}
public int getLogo() {
return logo;
}
public void setLogo(int logo) {
this.logo = logo;
}
}
Y pasarle las imagenes que entran al adapter:
Código Java:
Ver originalpublic class VersionesAdapter extends BaseAdapter {
private ArrayList<AndroidVersion> versiones;
private LayoutInflater mInflater;
public VersionesAdapter
(Context context,
ArrayList<AndroidVersion> vers) {
this.mInflater = LayoutInflater.from(context);
this.versiones = vers;
}
public int getCount() { return versiones.size(); }
public AndroidVersion getItem(int position) {
return versiones.get(position);
}
public long getItemId(int position) { return position; }
public View getView
(int position,
View convertView, ViewGroup parent
) { ViewHolder holder = null;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.lista_versionitem, null);
holder = new ViewHolder();
holder.hNombre = (TextView)
convertView.findViewById(R.id.idNombre);
holder.hVersion = (TextView) convertView
findViewById(R.id.idVersion);
holder.hImage = (ImageView)
convertView.findViewById(R.id.idLogo);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
AndroidVersion version = getItem(position);
holder.hNombre.setText(version.getNombre());
holder.hVersion.setText(version.getVersion());
holder.hImage.setImageResource(version.getLogo());
return convertView;
}
class ViewHolder {
TextView hNombre;
TextView hVersion;
ImageView hImage;
}
}