title: Crash log android ImageLoader must be init with configuration using universalimageloader
body: <p>Hello Has i am create sample view image concept Universal image loader lib , but i have initialization this line <br/><code>ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(MyActivit‌​y.this));</code>  in my ViewpagesAdapter.class</p>
  
  <p>Still i get the error :</p>
  
  <pre><code>java.lang.IllegalStateException: ImageLoader must be init with configuration before using
  at com.nostra13.universalimageloader.core.ImageLoader.checkConfiguration(ImageLoader.java:613)
  at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:236)
  at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:209)
  at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:410)
  at ****.****.adapter.ViewpagesAdapter.instantiateItem(ViewpagesAdapter.java:73)
  at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:870)
  at android.support.v4.view.ViewPager.populate(ViewPager.java:1020)
  at android.support.v4.view.ViewPager.populate(ViewPager.java:952)
  at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1474)
  at android.view.View.measure(View.java:17915)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5705)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
  at android.view.View.measure(View.java:17915)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5705)
  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692)
  at android.widget.LinearLayout.measureVertical(LinearLayout.java:760)
  at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
  at android.view.View.measure(View.java:17915)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5705)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2728)
  at android.view.View.measure(View.java:17915)
  at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2412)
  at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1414)
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1638)
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1292)
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6598)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800)
  at android.view.Choreographer.doCallbacks(Choreographer.java:603)
  at android.view.Choreographer.doFrame(Choreographer.java:572)
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
  at android.os.Handler.handleCallback(Handler.java:815)
  at android.os.Handler.dispatchMessage(Handler.java:104)
  at android.os.Looper.loop(Looper.java:194)
  at android.app.ActivityThread.main(ActivityThread.java:5631)
  at java.lang.reflect.Method.invoke(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
  </code></pre>
  
  <p>give me better solution ?</p>
  
  <p>My code line :</p>
  
  <pre><code>      public class ViewpagesAdapter extends PagerAdapter {
  
  // Declare variables
  private Activity activity;
  private ArrayList&lt;String&gt; filepath;
  private LayoutInflater inflater=null;
  public ImageLoader imageLoader;
  DisplayImageOptions options;
  
  
  public ViewpagesAdapter(Activity a, ArrayList&lt;String&gt; fpath) {
      activity = a;
      filepath = fpath;
      inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      File cacheDir = StorageUtils.getOwnCacheDirectory(a, "MyFolderCache");
      options = new DisplayImageOptions.Builder()
              .showImageOnLoading(R.drawable.image_thumbnail)
              .showImageForEmptyUri(R.drawable.image_thumbnail)
              .showImageOnFail(R.drawable.image_thumbnail)
              .cacheInMemory(true)
              .cacheOnDisk(true)
              .considerExifParams(true)
              .bitmapConfig(Bitmap.Config.RGB_565)
              .build();
  }
  
  @Override
  public int getCount() {
      return filepath.size();
  }
  
  @Override
  public void destroyItem(ViewGroup container, int position, Object object) {
      container.removeView((View) object);
  }
  
  @Override
  public boolean isViewFromObject(View view, Object object) {
      return view == object;
  }
  
  @Override
  public Object instantiateItem(ViewGroup container, int position) {
      View itemView;
      itemView=inflater.inflate(R.layout.pagesview, container, false);
      PhotoView image = (PhotoView)itemView.findViewById(R.id.image_pages);
      ImageLoader.getInstance().displayImage(filepath.get(position),image, options, new SimpleImageLoadingListener() {
          @Override
          public void onLoadingStarted(String imageUri, View view) {
  
          }
  
          @Override
          public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
  
          }
  
          @Override
          public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
          }
      }, new ImageLoadingProgressListener() {
          @Override
          public void onProgressUpdate(String imageUri, View view, int current, int total) {
          }
      });
  
      container.addView(itemView);
      return itemView;
  }
  </code></pre>