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
| public View getView(int position, View convertView, ViewGroup parent){
// * Le paramètre "convertView" permet de recycler les élements
// * de notre liste. En effet, l'opération pour convertir un layout
// * XML en IHM standard est très couteuse pour la plateforme Android.
// * On nous propose ici de réutiliser des occurences créées qui ne sont
// * plus affichées. Donc si ce paramètre est "null" alors, il faut "inflater"
// * notre layout XML, sinon on le réutilise
FeedView fv;
if (convertView == null) {
fv = new FeedView();//la classe feedview() contient la declaration de 3 textview
convertView = inflater.inflate(R.layout.feed_view, null);
fv.creator = (TextView)convertView.findViewById(R.id.creator);
fv.title = (TextView)convertView.findViewById(R.id.title);
fv.pubDate = (TextView)convertView.findViewById(R.id.pub_date);
convertView.setTag(fv);
} else
{
fv = (FeedView) convertView.getTag();
}
fv.creator.setText(feeds.get(position).getCreator());
fv.pubDate.setText(feeds.get(position).getPubDate());
fv.title.setText(feeds.get(position).getTitle());
return convertView;
} |
Partager