2013-05-31 29 views
2

https://github.com/nostra13/Android-Universal-Image-LoaderListview是否提前回收?還是Universal ImageLoader取消了錯誤?或者是我的邏輯錯誤?

除了listview中的第一項外,它的工作性能很好,它的圖像加載任務已取消。

它說,它Is called when image loading task was cancelled because View for image was reused in newer task

但由於觀點顯然仍清晰可見,這一觀點不應該被回收尚未?我正在使用convertView。

@Override 
    public View getView(int position, View convertView, ViewGroup parent) 
    { 
     if (getItemViewType(position) == HAS_IMAGE) 
     { 

      if (convertView == null) 
      { 
       convertView = li.inflate(R.layout.item_update_pic, null); 
       new UpdateWithImageWrapper(convertView, position); // this is where views are looked up and set 
      } 
      ((UpdateWithImageWrapper) convertView.getTag()).setMyData(data.get(position), position); // this is where the correct data is set to the views and images are set to be loaded 
     } 
     else 
     { 
      if (convertView == null) 
      { 
       convertView = li.inflate(R.layout.item_update, null); 
       new UpdateNoImageWrapper(convertView, position); 
      } 
      ((UpdateNoImageWrapper) convertView.getTag()).setMyData(data.get(position), position); 
     } 
     return convertView; 
    } 

有沒有人有解決方案?

編輯:只是想補充說,它有我的所有列表視圖的問題。使用

ImageLoader的1.8.4

或許有辦法阻止如此迅速回收列表視圖?

+0

Wiuld有興趣知道是否有辦法減慢回收,可能會添加某種緩衝區,因爲這可以解決問題。 – WIllJBD

回答

0

我終於想出了真正的答案。 在我ImageLoadingListener()

@Override 
    public void onLoadingCancelled(String imageUri, View view) { } 

我的圖像設置到代表加載錯誤圖像。事實證明,如果我不改變圖像,當這個方法被調用,然後一切工作正常。

所以對我來說真正的問題是,當調用onLoadingCancelled方法時,圖像已經被加載,並且在這裏將imageview設置爲表示取消的圖像會覆蓋真實圖像的成功加載。

相關問題