January 22, 2021
Hot Topics:

How Easy Is Android 3.0 Hardware Acceleration?, Page 2

  • By Lauren Darcey & Shane Conder
  • Send Email »
  • More Articles »

How Do I Turn Android 3.0 Hardware Acceleration On and Off?

You can turn hardware acceleration on by setting the android:hardwareAccelerated attribute to true in your Android manifest file. If you want your entire app accelerated, you set this attribute in the application tag. If you want only specific activities to be accelerated, simply turn off acceleration for specific activities by setting the same attribute android:hardwareAccelerated at the activity level to false.

For finer-grained control, you can also enable hardware acceleration at the window level by setting the FLAG_HARDWARE_ACCELERATED parameter. See the Android SDK documentation for details, including sample code.

Finally, you can toggle hardware and software acceleration at the View level using the setLayerType() method. See the Android SDK documentation for details on the setLayerType() method.

Is Android 3.0 Hardware Acceleration Really That Easy?

Well, yes and no. You still need to follow best practices for application design and in some cases, your application may need to be modified to really take advantage of the GPU. For example, keep your screens simple and limit the number of View controls, amongst others. Again, see Romain Guy's post for some do's and don'ts for writing GPU-friendly apps.


As you upgrade your applications to 3.0 and beyond, there's little reason not to turn on hardware acceleration for a smoother, more responsive experience for your users. Enabling your application to take advantage of the hardware acceleration available on devices running Android 3.0+ can be as easy as setting a flag in your application Manifest file and updating your application. You can also fine-tune your application graphics acceleration at the application, activity, or view level. As more users migrate to these newer versions of the Android SDK, this simply change to your app can help differentiate your from your competitors and please your users.

About the Authors

Shane Conder Shane Conder and Lauren Darcey--Contributing Editors, Mobile Development--have coauthored two books on Android development: an in-depth programming book entitled Android Wireless Application Development (ISBN-13: 978-0-321-62709-4) and Sams Teach Yourself Android Application Development in 24 Hours (ISBN-13: 978-0-321-67335-0). When not writing, they spend their time developing mobile software at their company and providing consulting services.

Email | Blog | Twitter

Lauren Darcey

Originally published on https://www.developer.com.

Page 2 of 2

This article was originally published on July 11, 2011

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date