I use this code in my getView:
@Override 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.listrow, null); } Order o = items.get(position); if (o != null) { TextView tt = (TextView) v.findViewById(R.id.toptext); ImageView thumb = (ImageView) v.findViewById(R.id.icon); if (o.getOrderDrawable() != null) { thumb.setImageDrawable(o.getOrderDrawable()); } else { tt.setText(o.getOrderTitle()); } } return v; }
The problem is scrolling; sometimes the correct image is displayed, but sometimes when scrolling back / forward, the images are displayed randomly and are not associated with the line.
Images are downloaded from the Internet.
How do I solve this problem?
android listview
Curtain
source share