Android Hardware Acceleration - to use or not to use?

Tal Kanel picture Tal Kanel · May 8, 2013 · Viewed 55.4k times · Source

I'm developing an app that it functionality very similar to Facebook Android native app: social network that most of the time the user will spend in an endless ListView displaying lot's of images, entering an image gallery, and so on.

let's say for the discussion that I'm doing all the right things and best android practices to achieve smooth scroll (recycling views as it should, using different view types when needed, loading to memory only scaled bitmaps in the needed size, caching bitmaps, using ViewHolder design pattern, not blocking th UI thread when its possible and so on...)

let's say also that every thing else in my app written in the best way and following best practices (for the discussion... :->)

my app working not bad at all in that stage, but when turning on the hardware acceleration, as described and promised in Android Developers documentation it making my app much much more smooth and fast.

let's say that it does not affect in any nagative way on the UI as can happened, and I'm not performing any of the Unsupported Operations

according to Google's document on the subject, only reason I can see not to use this feature (besides all other reasons I already mentioned above) is that it can cause my app to use more RAM. but how much RAM? a lot more? I know that when my app consumes lot's of RAM - it becoming good candidate to be destroyed by the OS when it need to free some memory.

my question is basically -

  • is it "ok" under my circumstances to use this feature?
  • what other problems can raise from using it?

TIA

Answer

ılǝ picture ılǝ · May 8, 2013

To use or not to use

It is advised to use hardware acceleration only if you have complex custom computations for scaling, rotating and translating of images, but do not use it for drawing lines or curves (and other trivial operations) (source).

If you plan on having common transitions and also given that you have already considered scaling, recycling, caching etc, than it may not make sense to burden your project anymore. Also, any efforts spent reworking your code to support hardware acceleration will not effect users on versions below 3.0, which are ~36% of the market as of May 8, 2013.

Memory

Regarding memory usage (according to this article), by including Android Hardware the application loads up the OpenGL drivers for each process, takes memory usage of roughly 2MB, and boosts it to 8MB.

Other issues

Apart from API versions, I presume it will also affect battery life. Unfortunately there aren't any benchmarks on different use cases online in order to draw a line on this one. Some argue that in given cases because of multiple gpu cores, using acceleration may save battery life. Overall, I think it would be safe that the effect won't be too dramatic (or Google would have made this a major point).