我发现这个例子:。
我有一个问题。 如果在Cachehton附近,则会有一个带Cancel的县。 在Click,我怎么能取消从国际不动产公司下载图像?
谢谢。
Edit: I think that it already has this method implemented:
public void stopThread()
{
photoLoaderThread.interrupt();
}
但是,我不知道如何从国祥线进入。 在《倡议》中,我只这样做:
adapter=new LazyAdapter(ctx, someString);
setListAdapter(adapter);
载于LazyAdapter:
public View getView(int position, View convertView, ViewGroup parent) {
...
imageLoader.DisplayImage(imagePath, activity, holder.image);
return vi;
}
和图象
public void DisplayImage(String url, Activity activity, ImageView imageView)
{
if(cache.containsKey(url))
imageView.setImageBitmap(cache.get(url));
else
{
queuePhoto(url, activity, imageView);
imageView.setImageResource(stub_id);
}
}
private void queuePhoto(String url, Activity activity, ImageView imageView)
{
//This ImageView may be used for other images before. So there may be some old tasks in the queue. We need to discard them.
photosQueue.Clean(imageView);
PhotoToLoad p=new PhotoToLoad(url, imageView);
synchronized(photosQueue.photosToLoad){
photosQueue.photosToLoad.push(p);
photosQueue.photosToLoad.notifyAll();
}
//start thread if it s not started yet
if(photoLoaderThread.getState()==Thread.State.NEW)
photoLoaderThread.start();
}
但我认为,从
感谢您的帮助。