Domanda

I'm a beginner in programing and all i want to do is compile this simple project I'm working on but I continue to get this same error, the code and error log are below.

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;
        }
....

Here is the error log. I'm using Android Studio for this project.

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)
È stato utile?

Soluzione

From the error messages, we can filter out other possibilities. And this is the most closest error.

"method ImageLoader.displayImage*(String,ImageView,DisplayImageOptions,ImageLoadingListener)* is not applicable (actual argument cannot be converted to ImageLoadingListener by method invocation conversion)"

Seems it is really complaints about "com.nostra13.universalimageloader.core.ImageLoadingListener"

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top