getView()で使用します-この例のメソッドは、ImageViewのソースをダウンロードするための静的関数です。後でスレッドが含まれます。ただし、この場合、静的関数の使用を節約する方法を一般的に知りたいと思います。
私が経験したので、場合によっては(私が本当に速くスクロールするとき)、画像が混同されます。
/**
* Is called, when the ListAdapter requests a new ListItem, when scrolling. Returns a listItem (row)
*/
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.row, null);
}
Order o = items.get(position);
if (o != null) {
TextView tt = (TextView) v.findViewById(R.id.toptext);
if (tt != null) {
tt.setText("Name: "+o.getOrderName()); }
//At this point I use a static function to download the bitmap to set it as source of an ImageView
}
return v;
}