title: Why this Error occurred? java.lang.RuntimeException: ImageLoader must be init with configuration before using
body: <p>I have downloaded one ImageDownloader code from gitHub(<a href="https://github.com/nostra13/Android-Universal-Image-Loader" rel="nofollow noreferrer">from Here</a>)
  Now when I am trying to download the image from my webservice I am getting this Runtime Exception "ImageLoader must be init with configuration before using".</p>
  
  <p>I am not able to figure it out.</p>
  
  <p>And this my adapter:</p>
  
  <pre><code>public class CustomAdapter extends BaseAdapter 
  {
      private Context context;
      private ArrayList&lt;String&gt; logo_URL;
  
      private ListContent listContent;
      private ArrayList&lt; TeamDataClass&gt; teamdata = null;
      private ArrayList&lt;EventDataClass&gt; eventdata = null;
      private DisplayImageOptions options;
      private ImageLoader imageLoader;
  
      public CustomAdapter(Context context,ArrayList&lt;String&gt; logo_URL,ArrayList&lt;TeamDataClass&gt; teamdata, ArrayList&lt;EventDataClass&gt; eventdata) 
      {
          this.context = context;
          this.logo_URL = logo_URL;
          this.teamdata = teamdata;
          this.eventdata = eventdata;
          options = new DisplayImageOptions.Builder()
          .showImageForEmptyUri(R.drawable.image_for_empty_url)
          .cacheOnDisc()
          .imageScaleType(ImageScaleType.EXACT)
          .build();
          imageLoader= ImageLoader.getInstance();
      } 
  
      //@Override
      public int getCount() 
      {
          return teamdata.size()/2;
      }
  
      //@Override
      public Object getItem(int arg0) 
      {
          return arg0;
      }
  
      //@Override
      public long getItemId(int arg0) 
      {
          return arg0;
      }
  
      //@Override
      public View getView(int arg0, View convertview, ViewGroup arg2) 
      {
          LayoutInflater inflater = ((Activity) context).getLayoutInflater();
          if (convertview == null ) 
          {
              convertview = inflater.inflate(R.layout.custom_list_score, null);
              listContent = new ListContent();
              listContent.team_logo2 = (ImageView) convertview.findViewById(R.id.team_logo2);
              listContent.team_logo1 = (ImageView) convertview.findViewById(R.id.team_logo1);
              listContent.progress_team1=(ProgressBar)convertview.findViewById(R.id.progress_team_logo1);
              listContent.progress_team2=(ProgressBar)convertview.findViewById(R.id.progress_team_logo2);
  
              convertview.setTag(listContent);
          }
          else 
          {
              listContent = (ListContent) convertview.getTag();
          }
          listContent.status.setText(eventdata.get(arg0).status);
          int pos=arg0*2;
          imageLoader.displayImage(logo_URL.get(pos),listContent.team_logo1, options,new ImageLoadingListener() 
          {
              //@Override
              public void onLoadingStarted()
              {
                  listContent.progress_team1.setVisibility(View.VISIBLE);
              }
  
              //@Override
              public void onLoadingFailed(FailReason failReason)
              {
                  String message = null;
                  switch (failReason) 
                  {
                      case IO_ERROR:
                          message = "Input/Output error";
                          break;
                      case OUT_OF_MEMORY:
                          message = "Out Of Memory error";
                          break;
                      case UNKNOWN:
                          message = "Unknown error";
                          break;
                  }
                  Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
  
                  listContent.progress_team1.setVisibility(View.GONE);
                  listContent.team_logo1.setImageResource(android.R.drawable.ic_delete);
              }
  
              //@Override
              public void onLoadingComplete(Bitmap loadedImage)
              {
                  listContent.progress_team1.setVisibility(View.GONE);
                  Animation anim = AnimationUtils.loadAnimation(context, R.anim.fade_in);
                  listContent.team_logo1.setAnimation(anim);
                  anim.start();
              }
  
              //@Override
              public void onLoadingCancelled()
              {
                  // Do nothing
              }
  
              public void onLoadingComplete() {
  
              }
          }); 
          imageLoader.displayImage(logo_URL.get(pos+1),listContent.team_logo2, options,new ImageLoadingListener() 
          {
              //@Override
              public void onLoadingStarted()
              {
                  listContent.progress_team2.setVisibility(View.VISIBLE);
              }
  
              //@Override
              public void onLoadingFailed(FailReason failReason)
              {
                  String message = null;
                  switch (failReason) 
                  {
                      case IO_ERROR:
                          message = "Input/Output error";
                          break;
                      case OUT_OF_MEMORY:
                          message = "Out Of Memory error";
                          break;
                      case UNKNOWN:
                          message = "Unknown error";
                          break;
                  }
                  Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
  
                  listContent.progress_team2.setVisibility(View.GONE);
                  listContent.team_logo2.setImageResource(android.R.drawable.ic_delete);
              }
  
              //@Override
              public void onLoadingComplete(Bitmap loadedImage)
              {
                  listContent.progress_team2.setVisibility(View.GONE);
                  Animation anim = AnimationUtils.loadAnimation(context, R.anim.fade_in);
                  listContent.team_logo2.setAnimation(anim);
                  anim.start();
              }
  
              //@Override
              public void onLoadingCancelled()
              {
                  // Do nothing
              }
  
              public void onLoadingComplete() {
  
              }
          }); 
  
          return convertview;
      }
      private class ListContent
      {
          ImageView team_logo1, team_logo2;
          ProgressBar progress_team1,progress_team2;
      }
  }
  </code></pre>
  
  <p>This is my logcat:</p>
  
  <pre><code>FATAL EXCEPTION: main
  java.lang.RuntimeException: ImageLoader must be init with configuration before using
  at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:164)
  at com.huskerit.score.CustomAdapter.getView(CustomAdapter.java:100)
  at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
  at android.widget.AbsListView.obtainView(AbsListView.java:1554)
  at android.widget.ListView.measureHeightOfChildren(ListView.java:1288)
  at android.widget.ListView.onMeasure(ListView.java:1199)
  at android.view.View.measure(View.java:8313)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
  at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:701)
  at android.widget.LinearLayout.onMeasure(LinearLayout.java:311)
  at android.view.View.measure(View.java:8313)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
  at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
  at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
  at android.view.View.measure(View.java:8313)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  at android.view.View.measure(View.java:8313)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  at android.view.View.measure(View.java:8313)
  at android.view.ViewRoot.performTraversals(ViewRoot.java:844)
  at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:3687)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>