Android-universal-image-loader: Does Android-Universal-Image-Loader support Asset folder?

Created on 17 Dec 2012  路  8Comments  路  Source: nostra13/Android-Universal-Image-Loader

Hi nostra13,

I was going to use this lib in my project, but after some searches, I couldn't figure out how to use this lib to load images from assets folder, even when I used "file:///android_asset/... , it didn't work.

        mImageLoader.displayImage("file:///android_asset/" + path, 
                iv, Const.displayImageOptions, 
                new SimpleImageLoadingListener()
        {
            @Override
            public void onLoadingComplete(Bitmap loadedImage) {
                Animation anim = AnimationUtils
                        .loadAnimation(mContext, R.anim.fade_in);
                iv.setAnimation(anim);
                anim.start();
            }
        }); 

If it's possible, could you provide me some code? or even if I have to customized some code myself, please let me know how to do it.

Thanks in advance and sorry for my bad English :)

Question

Most helpful comment

assets://... scheme is supported out of box now

All 8 comments

Hi,
Look into example project. I implemented example of using images from assets and drawables. Use ExtendedImageDownloader and "assets://" prefix.

Hi,
I've got it worked, sorry that I didn't look closely to your example.
Thank you so much.
Leo!

hey @nostra13 @mrleolink please help me with getting images from drawable folder using this library. can you paste snippet which will guide me to use this library with drawable folder.
when i try to use ExtendedImageDownloader it gives me error ExtendedImageDownloader cannot be resolve to a type.

I tried setting config from Example

ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.threadPriority(Thread.NORM_PRIORITY - 2)
.memoryCacheSize(2 * 1024 * 1024) // 2 Mb
.denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator())
.imageDownloader(new ExtendedImageDownloader(getApplicationContext()))
.tasksProcessingOrder(QueueProcessingType.LIFO)
.enableLogging() // Not necessary in common
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);

@ManojMM026 ExtendedImageDownloader is not a part of the library yet. You should copy-paste it from example to your project..

@nostra13 Where is ExtendedImageDownloader? I couldn't find in your project. Can you pl give me the link?

assets://... scheme is supported out of box now

Thanks, it's working.

Can I use subfolders in assets folder?
like this assets://images/test.png

Was this page helpful?
0 / 5 - 0 ratings