Sep 4, 2011

Hardware acceleration can be all the difference

Having worked on Android applications for a while, one issue always struck me while comparing Android apps with their iOS counterparts: animation smoothness. If you have seeing both platforms, you've might noticed that graphic animations on an iPhone look way better than on Android. I didn't know the reason until yesterday, when I came across this blog post on the Android Developers blog.

In short: hardware acceleration.

I'm not going to talk about hardware acceleration at all, but I want to say out aloud how different things look after enabling it. I finished last week an application designed for Honeycomb, and when the Project Manager asked me if I could make a fade in / fade out animation run smoothly, I had to say "sorry, that's all I could get".

Well Jeff, I've got a surprise for you.

I read the entire blog post to be sure I wasn't doing something wrong, opened my manifest file and added the magic setting: android:hardwareAccelerated="true". Everything else is history: all the animations look so good now I wanted to cry. All the choppiness and rigidness is now gone. Transitions are the way they were supposed to be, and in general, the application jumped from "It's ok" to "This is what I'm talking about!"

As a final note before getting crazy over there, go ahead and read the entire post because (as usual), this is not a silver bullet to fix everything. There are some use cases where enabling hardware acceleration can cause problems, so you need to be aware how to avoid them.

But for me, it made my weekend.