The Universal Image Loader was used to display Gridview, View Paper in this project. I need to integrate the offline mode for the app. I need to download and store images on the disk in separate thread and then when the gridview is displayed, the viewpage images should be loaded from the disk. How to implement universal-image loader in separate thread? I have tried to do this but after some time it goes out of activity like thread and loading is more than the universal imageloader app cache, I mean somethings go wrong I saw different discussions But I need to download it through a separate thread through UIL.
@ Override Public Wide Run () {int x = 0; While (x <1) {try {thread.sleep (1500); } Grip (Interrupted e) e.printStackTrace (); } Procedures (); }} Public Zero Process Bitmap () {fulls = Application.getOnThisDeviceFulls (); If (full! = Null & amp; full. Size ()> gt; (for (int index = 0; index & lt; full; size); index ++) {complete full = full.gate (index). GetFull (); ArrayList & LT; Page & gt; Pages = Full. Gate (index) for .getPages (); for (int j = 0; j & lt; pages.size (); j ++) {string pages Page = ... try {thread »sleep (1500);} grip (interrupted e) e.printStackTrace ();} LoadUILImage (); if (j == pages.size () - 1) {Application.removeFullOnDevice (Index);} if (rescindex) {brake;}} if (resetmagazineindex) {magazineIndex = 0; log. ResetIndex = false;)}}}}
Thread based works in the document:
// Load image, Decode bitmap and callLocker.loadImage (imageUri, New SimpleImageLoadingListener) {@ Override public loading over zero (String image Yuri, View View, Bitmap Loaded Image) {/ you want with bitmap}});
Use ImageLoaderConfiguration
to define special threading parameters:
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder (references ). Threadpool size (3). Public Null Load Image (String Yuri, ImageLoadingListener Listener)
From:
Public Zero Load Image (Thread.NORM_PRIORITY - 2) ...
Code>Load image works for the execution pool. The image will be returned with ImageLoadingListener.onLoadingComplete (string, android.view.View, android.graphics.bitmap) callback}. Note: This method should call the init (ImageLoaderConfiguration) method before calling
No comments:
Post a Comment