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:
Application
orActivity
class (before the first usage ofImageLoader
)
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(getBaseContext()));
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 constructorimageLoader.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
Open Gallery App from Android Intent
Java.Lang.Classnotfoundexception: Org.Postgresql.Driver, Android
Prevent Webview from Displaying "Web Page Not Available"
App Crashing When Trying to Use Recyclerview on Android 5.0
Deadobjectexception on Android App
How to Get Selected Xls File Path from Uri for Sdk 17 or Below for Android
Android 3.1 Usb-Host - Broadcastreceiver Does Not Receive Usb_Device_Attached
Android Color Notification Icon
Android Call a Method from Another Class
Converting Epoch Time to Date String
Read/Write .Txt File with Special Characters
R: Cannot Install Rjava; What Is R-Api-3.4
Running a .SQL Script Using MySQL with Jdbc
How to Increase the Number of Displayed Lines of a Java Stack Trace Dump