{"id":21129984,"url":"https://github.com/wuman/AndroidImageLoader","last_synced_at":"2025-07-09T01:31:53.317Z","repository":{"id":5251270,"uuid":"6428948","full_name":"wuman/AndroidImageLoader","owner":"wuman","description":"Andorid library that loads images asynchronously into cache using a thread pool","archived":false,"fork":false,"pushed_at":"2013-12-04T16:16:11.000Z","size":1584,"stargazers_count":62,"open_issues_count":2,"forks_count":18,"subscribers_count":13,"default_branch":"master","last_synced_at":"2023-07-03T03:43:45.604Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://wuman.github.com/AndroidImageLoader/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"diegonehab/luasocket","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wuman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-28T15:40:50.000Z","updated_at":"2022-12-28T23:13:51.000Z","dependencies_parsed_at":"2022-09-10T23:40:53.956Z","dependency_job_id":null,"html_url":"https://github.com/wuman/AndroidImageLoader","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuman%2FAndroidImageLoader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuman%2FAndroidImageLoader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuman%2FAndroidImageLoader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuman%2FAndroidImageLoader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wuman","download_url":"https://codeload.github.com/wuman/AndroidImageLoader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225476379,"owners_count":17480215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T05:32:08.800Z","updated_at":"2024-11-20T05:32:09.926Z","avatar_url":"https://github.com/wuman.png","language":"Java","funding_links":[],"categories":["Libs"],"sub_categories":["\u003cA NAME=\"Image_Loading\"\u003e\u003c/A\u003eImage Loading"],"readme":"AndroidImageLoader\n==================\n\n![Feature Image](https://raw.github.com/wuman/AndroidImageLoader/master/library/src/site/static/feature.png)\n\nAndroidImageLoader is a fork of the \n[Image Loader](http://code.google.com/p/libs-for-android/wiki/ImageLoader) \ncomponent in [libs-for-android](http://code.google.com/p/libs-for-android/).\n\nThe AndroidImageLoader is an Android library that helps to load images \nasynchronously. Like its upstream libs-for-android project, it executes\nimage requests in a thread pool and provides caching support. The following\nfeatures of libs-for-android are kept:\n\n* Images are downloaded and saved to cache via a pool of background threads.\n* Supports preloading of off-screen images into a memory cache.\n* Supports prefetching of images into a disk cache.\n* `HttpUrlConnection` is used for loading images, which respects cache control.\n* Custom `URLStreamHandlerFactory` is supported for creating connections to\n  special URLs such as `content://` URIs.\n* Supports `Bitmap` transformations by accepting a `ContentHandler` for loading\n  images.\n\nThe AndroidImageLoader improves libs-for-android in the following ways:\n\n* In addition to memory cache, the library also supports second level disk caching.\n  Caching support in AndroidImageLoader is now made to depend on the\n  [TwoLevelLruCache](http://wuman.github.com/TwoLevelLruCache/) library, which in\n  turn depends on the more widely used `LruCache` and `DiskLruCache`.\n* Image requests are now placed into a LIFO task queue, which makes more sense in\n  most scrolling scenarios.\n* The API for view binding is now in a separate `ViewBinder` class. Applications\n  can use the `ImageViewBinder` class to bind to `ImageView`s or extend the \n  `AbstractViewBinder` class for custom views. Also, `ImageView`s within an\n  `AdapterView` no longer require a different kind of binding.\n* `OutOfMemoryError`s are automatically detected and caught. When memory is\n  running low, the cache size is automatically decreased to give back more\n  memory to the system.\n* Prefetching can now be supported out of the box via the `SinkContentHandler`\n  and the [HttpResponseCache library](https://github.com/candrews/HttpResponseCache).\n\n\nUSAGE\n-----\n\nThe `ImageLoader` should be installed as a pseudo-system service. This is so that\nit can be used as a singleton and accessed across Activities. You do this by\ndeclaring a customized `Application` in the `AndroidManifest.xml`:\n\n    public class SamplesApplication extends Application {\n        private ImageLoader mImageLoader;\n\n        @Override public void onCreate() {\n            super.onCreate();\n            try {\n                mImageLoader = createImageLoader(this);\n            } catch (IOException e) {\n            }\n        }\n\n        @Override public void onTerminate() {\n            mImageLoader = null;\n            super.onTerminate();\n        }\n\n        @Override public Object getSystemService(String name) {\n            if (ImageLoader.IMAGE_LOADER_SERVICE.equals(name)) {\n                return mImageLoader;\n            } else {\n                return super.getSystemService(name);\n            }\n        }\n        \n        ...\n    }\n\nAn example of creating the `ImageLoader` instance can be:\n\n    private static ImageLoader createImageLoader(Context context)\n            throws IOException {\n        ContentHandler prefetchHandler = null;\n        try {\n            HttpResponseCache.install(\n                    new File(context.getCacheDir(), \"HttpCache\"),\n                    ImageLoader.DEFAULT_CACHE_SIZE * 2);\n            prefetchHandler = new SinkContentHandler();\n        } catch (Exception e) {\n        } \n\n        // Use a custom URLStreamHandlerFactory if special URL scheme is needed\n        URLStreamHandlerFactory streamFactory = null;\n\n        // Load images using the default BitmapContentHandler\n        ContentHandler bitmapHandler = new BitmapContentHandler();\n        bitmapHandler.setTimeout(5000);\n        \n        return new ImageLoader(\n            streamFactory, bitmapHandler, prefetchHandler,\n            ImageLoader.DEFAULT_CACHE_SIZE, \n            new File(context.getCacheDir(), \"images\"));        \n    }\n\nObtaining the `ImageLoader` from within an `Activity` is easy:\n\n    ImageLoader imageLoader = ImageLoader.get(context);\n\nBinding an image to `ImageView` is done via `ImageViewBinder`:\n\n    ImageViewBinder binder = new ImageViewBinder(mImageLoader);\n    binder.bind(imageView, url);\n\nOptionally you can set alternative images to display:\n\n    binder.setLoadingResource(R.drawable.loading);\n    binder.setErrorResource(R.drawable.unavailable);\n\nBy default images loaded from disk cache or network are faded in. You can\ndisable this special effect by:\n\n    binder.setFadeIn(false);\n\nNote that the `ViewBinder` automatically checks whether the target `View` is\nstill requesting the same URL or already recycled to request another image.\n\nCustom view binding is supported by extending the `AbstractViewBinder\u003cV\u003e` class\nand overriding at least the following two methods:\n\n* `void onImageLoaded(V targetView, Bitmap bitmap, String url, LoadSource loadSource)`\n* `void onImageError(V targetView, String url, Throwable error)`\n\n\nSAMPLES\n-------\n\nSample applications are provided to better understand how to use the library.\n\n* _ImageViewBinding_: loading of images using the `ImageViewBinder`.\n* _CustomViewBinding_: loading of images into custom views by extending the \n  `AbstractViewBinder` class.\n* _FlickrInterestingness_: practical example of loading Flickr images from its \n  Web API using the AndroidImageLoader in combination with the \n  [AndroidFeedLoader](http://wuman.github.com/AndroidFeedLoader/).\n\n\nINCLUDING IN YOUR PROJECT\n-------------------------\n\nThere are two ways to include AndroidImageLoader in your projects:\n\n1. You can download the released jar file in the [Downloads section](https://github.com/wuman/AndroidImageLoader/downloads).\n2. If you use Maven to build your project you can simply add a dependency to this library.\n\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.wu-man\u003c/groupId\u003e\n            \u003cartifactId\u003eandroidimageloader-library\u003c/artifactId\u003e\n            \u003cversion\u003e0.1\u003c/version\u003e\n        \u003c/dependency\u003e\n\n\nCONTRIBUTE\n----------\n\nIf you would like to contribute code to AndroidImageLoader you can do so through \nGitHub by forking the repository and sending a pull request.\n\n\nDEVELOPED BY\n------------\n\n* David Wu - \u003cdavid@wu-man.com\u003e - [http://blog.wu-man.com](http://blog.wu-man.com)\n\n\nLICENSE\n-------\n\n    Copyright 2012 David Wu\n    Copyright (C) 2010 Google Inc.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software \n    distributed under the License is distributed on an \"AS IS\" BASIS, \n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and \n    limitations under the License.\n\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/wuman/androidimageloader/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuman%2FAndroidImageLoader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwuman%2FAndroidImageLoader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuman%2FAndroidImageLoader/lists"}