1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| public class AdapterList extends ArrayAdapter<Album> {
public AdapterList(Context context, int resource, List<Album> list) {
super(context, resource);
for (Album a : list) {
add(a);
}
}
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.row_album_layout, parent, false);
TextView textView = (TextView) rowView.findViewById(R.id.label);
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
textView.setText(getItem(position).getTitle());
DownloadImageTask dwt = new DownloadImageTask(imageView);
dwt.execute(getItem(position).getCover());
if (convertView != null)
rowView = (View) convertView;
return rowView;
}
} |
Partager