Android - Imageloader Must Be Init with Configuration Before Using in Uil

ImageLoader must be init with configuration before using

You haven't initialized ImageLoader in your onCreateView. Add this line after onCreateView:

ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(getActivity()));

From the library documentation:


  1. Application or Activity class (before the first usage of ImageLoader)
public class MyActivity extends Activity {
@Override
public void onCreate() {
super.onCreate();

// Create global configuration and initialize ImageLoader with this config
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
...
.build();
ImageLoader.getInstance().init(config);
...
}
}

Android - ImageLoader must be init with configuration before using in UIL

Try to implement this inside your onCreateView:

For Activity -

BaseActivity.imageLoader.init(ImageLoaderConfiguration.createDefault(getBaseCont‌​ext()));

For Fragment -

ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(getActivity()));

Android - Universal ImageLoader error must be init with configuration before using

You need to call init(conf) method before using displayImage().

You are not using getConfig() method so you should probably add in UniversalImageLoader constructor
imageLoader.init(ImageLoaderConfiguration.createDefault(getConfig()));

Why this Error occurred? java.lang.RuntimeException: ImageLoader must be init with configuration before using

I have added this line in my Constructor and its worked for me...

imageLoader.init(ImageLoaderConfiguration.createDefault(context));

Android - Image Loader Error

Sorry guys, somehow i solve my problem with add this to my onCreate method

ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(this));

But, thanks all for your help.

Fix warning of Universal Image Loader: Try to initialize ImageLoader which had already been initialized before. Universal image loader

I'm assuming you have it on a Activity.

if you are going to put it in there, you would have to call ImageLoader.destroy on onDestroy like this:

protected void onDestroy() {
ImageLoader.getInstance().destroy();
}

You could put the initialization in your Application Class http://developer.android.com/reference/android/app/Application.html
something like this:

YourApplication extends Application {
protected void onCreate() {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.defaultDisplayImageOptions(defaultOptions)
.denyCacheImageMultipleSizesInMemory()
.build();
ImageLoader.getInstance().init(config);
}
}


Related Topics



Leave a reply



Submit