Archive for the ‘ImageView’ Category

Memory Cache – Part 4

Friday, April 13th, 2012

In the previous part of this series we implemented a simple memory cache based upon WeakReference. It certainly improved performance when we were using the same image multiple times within a short period, but it is easy to predict that our cached images would not survive an intensive operation, such as an Activity transition. Also, the policy of when to free cached items was completely outside of our control. While there are certainly use-cases where this is not an issue, it is often necessary to have rather more control. In this article we’ll look at LruCache which gives us precisely that.
(more…)

DeliciousStumbleUponRedditDiggBookmark/FavoritesShare

Memory Cache – Part 3

Friday, April 6th, 2012

In the previous part of this series we looked at why caching images may help the performance of our app, so let’s firstly look at a technique for creating a short-lived cache. The items in the cache will only survive until the next GC if they are not strongly referenced, but this can sometimes be desirable if we want to be extremely conservative with resources.
(more…)

DeliciousStumbleUponRedditDiggBookmark/FavoritesShare

Memory Cache – Part 2

Friday, March 30th, 2012

In the previous article we looked at the theory behind weak references. In this article we’ll look at one use-case where a simple memory cache may speed things up.
(more…)

DeliciousStumbleUponRedditDiggBookmark/FavoritesShare

Memory Cache – Part 1

Friday, March 23rd, 2012

Previously on Styling Android we have discussed how important it is to make your app as fast as possible because making your user wait for things to happen is a sure way to drive them away from your app. Also, you have to be quite careful when it comes to using images within your app because images tend to be relatively large and even minor inefficiencies in image handling can have a major impact on your app. In this series of articles we’re going to look at a technique of using a memory cache for images to avoid having to hold multiple copies of the same image in memory when that image is used multiple times in your layout.
(more…)

DeliciousStumbleUponRedditDiggBookmark/FavoritesShare

Compound Drawables

Friday, January 20th, 2012

I recently learned about a small feature in Android which has been there since API level 1 (the variant that we’ll use has been in there since API 3, but others appeared in API 1): Compound Drawables. In this article we’ll have a look at what they are and see how we can use them to simplify some of our layouts.
(more…)

DeliciousStumbleUponRedditDiggBookmark/FavoritesShare