|Jae on Android: understanding Widgets|
|igor.ganapolsky on Android: Using Context statica…|
|Using Context static… on Android: Using Context statica…|
|derp on Android: Using Context statica…|
|nfrolov on How SMB works|
This is more of an announcement. I’ve uploaded a new opensource project, ImageCache. As the name suggests, it’s a component for Android that handles downloading and displaying images from the Internet. Basic call is like this:
CacheQueue.displayImage(imageView, "http://i.imgur.com/u0NjkvC.jpg", 600);
With this call, the component will download file from given URL, save it to disk (I kinda like saying disk, it’s not a disk though), open with dimensions around 600px on the longest side, and assign to the imageView. If the imageView somehow became irrelevant in the process (say the activity reloaded), then cache wouldn’t keep it and will just store the image. Naturally, subsequential calls for that same url will either pull the image from memory, or from the disk cache.
This sounds simple so far, and you might wonder why wouldn’t I just use AsyncTask for that like a normal person. As it turns out, there is more.
Initially I developed this code as part of a Reddit client for a customer, but then I had rewritten it for my own purposes. Not sure if it’s very useful as an actual component (caching requirements often differ a lot), but you’re welcome to check it out if you’re building your own.