Archive for the ‘ImageView’ Category

Blurring Images – Part 7

Friday, March 28th, 2014

In the previous article we performed some simple optimisations which enormously improved the frame rate of our animations. However, we mentioned that increasing the size of the area that we wish to blur will slow the frame rate because the complexity of the blur operation will increase exponentially. In this article we’ll look at an alternative approach which should permit us to animate larger areas.
(more…)

Blurring Images – Part 2

Friday, February 21st, 2014

Previously we looked at a method which uses RenderScript to blur the section of an image which lies within the bounds of another view. However we didn’t get as far as actually calling that method and see the blurring in action. The reason for this is that we need to think quite carefully about performance, and on this article we shall look in to this further.
(more…)

Blurring Images – Part 1

Friday, February 14th, 2014

There are a lot of cool effects that we can do in Android to manipulate images, and I cover some of these in my conference presentation for 2014 entitled Graphical Magic. One technique that I cover in the presentation is how to blur images and the example code uses RenderScript to perform the blur because there is no simple API built into Android that we can use. In this series we’ll look at both the RenderScript blurring technique, and also how we can also perform blurring in Java. We’ll also perform some benchmarking to understand how well each approach performs, and look at ways that we can obtain the best performance.
(more…)

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…)

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…)

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…)

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…)

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…)