简体   繁体   中英

using Android Universal Image Loader in acivity inside library project

i have problem on calling activity inside library

i use https://github.com/nostra13/Android-Universal-Image-Loader

inside activity in library project. i setup it inside application class in main project that use library

https://github.com/nostra13/Android-Universal-Image- Loader/blob/master/sample/src/com/nostra13/example/universalimageloader/UILApplication.java

but when i want use it in acitivity that are inside library return this error "ImageLoader must be init with configuration before using is the error from Illegal State Exception how can i solve it

For your solution you need to use this

ImageLoader imgLoader = ImageLoader.getInstance();
imgLoader.init(ImageLoaderConfiguration.createDefault(YourActivityName.this));
options = new DisplayImageOptions.Builder().cacheInMemory(true)
            .showImageOnLoading(R.drawable.placeholder)
            .showImageOnFail(R.drawable.error).considerExifParams(true)
            .build();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM