2014-01-16 101 views
0

我是編程的初學者,我想要做的就是編譯我正在處理的這個簡單的項目,但我仍然得到相同的錯誤,代碼和錯誤日誌如下。Android通用圖像加載程序編譯器錯誤

ImageGridActivity.java

.... 

imageLoader.displayImage(imageUrls[position], imageView, options, new ImageLoadingListener() { 
       @Override 
       public void onLoadingStarted() { 
        // do nothing 
       } 

       @Override 
       public void onLoadingFailed(FailReason failReason) { 
        imageView.setImageResource(android.R.drawable.ic_delete); 

        switch (failReason) { 
         case MEMORY_OVERFLOW: 
          imageLoader.clearMemoryCache(); 
          break; 
        } 
       } 

       @Override 
       public void onLoadingComplete() { 
        // do nothing 
       } 
      }); 

      return imageView; 
     } 
.... 

以下是錯誤日誌。我正在使用Android Studio進行此項目。

GridViewerBro/BRO/src/main/java/com/example/bro/ImageGridActivity.java:97: error: no suitable method found for displayImage(String,ImageView,DisplayImageOptions,<anonymous com.nostra13.universalimageloader.core.ImageLoadingListener>) 
      imageLoader.displayImage(imageUrls[position], imageView, options, new ImageLoadingListener() { 
        ^
    method ImageLoader.displayImage(String,ImageView,DisplayImageOptions,ImageLoadingListener,ImageLoadingProgressListener) is not applicable 
     (actual and formal argument lists differ in length) 
    method ImageLoader.displayImage(String,ImageView,DisplayImageOptions,ImageLoadingListener) is not applicable 
     (actual argument <anonymous com.nostra13.universalimageloader.core.ImageLoadingListener> cannot be converted to ImageLoadingListener by method invocation conversion) 
    method ImageLoader.displayImage(String,ImageView,ImageLoadingListener) is not applicable 
     (actual and formal argument lists differ in length) 
    method ImageLoader.displayImage(String,ImageView,DisplayImageOptions) is not applicable 
     (actual and formal argument lists differ in length) 
    method ImageLoader.displayImage(String,ImageView) is not applicable 
     (actual and formal argument lists differ in length) 
    method ImageLoader.displayImage(String,ImageAware,DisplayImageOptions,ImageLoadingListener,ImageLoadingProgressListener) is not applicable 
     (actual and formal argument lists differ in length) 
    method ImageLoader.displayImage(String,ImageAware,DisplayImageOptions,ImageLoadingListener) is not applicable 
     (actual argument ImageView cannot be converted to ImageAware by method invocation conversion) 
    method ImageLoader.displayImage(String,ImageAware,DisplayImageOptions) is not applicable 
     (actual and formal argument lists differ in length) 
    method ImageLoader.displayImage(String,ImageAware,ImageLoadingListener) is not applicable 
     (actual and formal argument lists differ in length) 
    method ImageLoader.displayImage(String,ImageAware) is not applicable 
     (actual and formal argument lists differ in length) 

回答

0

從錯誤消息中,我們可以篩選出其他可能性。這是最接近的錯誤。

「方法ImageLoader.displayImage * (字符串,ImageView的,DisplayImageOptions,ImageLoadingListener) *是不適用(實際參數不能通過方法調用轉換被轉換爲ImageLoadingListener)」

好像它是真正的投訴關於「com.nostra13.universalimageloader.core.ImageLoadingListener」

+0

我把它作爲com.nostra13.universalimageloader.core.ImageLoadingListener – user3135837

+0

嗯,我仍然懷疑是這個問題。如果可能,你能告訴我可下載的鏈接嗎?我知道github有這個項目,但ImageLoadingListener位於「核心/庫」文件夾內而不是「核心」文件夾。 –

+0

它在這裏https://github.com/nostra13/Android-Universal-Image-Loader – user3135837