我正在使用线程在我的 BaseAdapter 类的 getview() 中加载图像。但是图像没有正确加载..当我滚动列表视图图像正在改变..某些位置出现相同的图像..帮我解决这个问题。
这是我的getview代码:
public View getView(int position, View convertView, ViewGroup parent)
{
// TODO Auto-generated method stub
// View listView = convertView;
Position=position;
ViewHolder holder;
Thread thread = new Thread()
{
public void run()
{
bitmap= DownloadImage(
kickerimage[Position] );
}
};
thread.start();
// Bitmap bitmap= DownloadImage(
// kickerimage[position] );
if (convertView == null)
{
//this should only ever run if you do not get a view back
LayoutInflater inflater = (LayoutInflater) contxt
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.homelistrow, null);
holder = new ViewHolder();
holder.image = (ImageView) convertView
.findViewById(R.id.icon);
holder.text = (TextView) convertView
.findViewById(R.id.name_label);
convertView.setTag(holder);
}
else
{
holder = (ViewHolder) convertView.getTag();
}
//
holder.image.setImageBitmap(bitmap);
//// items=itemsarray[position];
holder.text.setText(itemsarray[position]);
return convertview
}