Android UI Design Principles, Page 2
Now let's talk about how to make your application screens load faster with good user interface design principles:
Android App Performance Tip #6: Keep Your Layouts Simple, Elegant, and Shallow
Simple screens make for the easiest reading and simple layouts load the fastest. You don't want to nest your layouts too deeply or clutter your screens with more View controls than absolutely necessary. Spend the time to develop elegant user interfaces that users can use effectively instead of trying to cram too much functionality onto a single screen. Not only will this help application performance, but it will help make your application more efficient for users.
Fragments can help compartmentalize user interface functionality without sacrificing flexibility for designing for different types of devices.
Android App Performance Tip #7: Tailor Your Application Resources To Your Target Devices
Include resources that are tailored to specific device configurations, so that they load as efficiently as possible. This is especially important when we're talking about graphics resources. If you include huge drawable image resources that require loading and resizing, you're not using alternative application resources effectively.
Another trick? To keep your application package file reasonably sized when targeting many devices, only include core resources needed to run the application initially, then have the application download content tailored to the device.
Android App Performance Tip #8: Use the Hierarchy Viewer Tool
The Hierarchy Viewer tool helps you debug your application layouts. It also provides valuable profiling information about how long it takes each View control within a layout to measure, render, and draw. Pinpoint problem areas and fix them easily.
Android App Performance Tip #9: Use the layoutopt Tool
The layoutopt tool is a simple command-line tool that can help you identify unnecessary nesting of controls and other ways to collapse your layout resources to make them as slim as possible. It will give you hints on what layout controls may be redundant or unnecessary. Fewer controls and shallower layouts perform better.
And finally… So you think your app is the best it can be? Now it's time to put it to the test.
Android App Performance Tip #10: Use Traceview and Other Android Tools for Profiling
The Android SDK comes with a number of tools for profiling your applications. Perhaps the most popular tool is Traceview, a graphical tool that can help you debug and find performance bottlenecks in your apps. Check out some debugging tools discussed in the Android documentation.
There are many ways to speed up the performance of your Android applications. Some involve using specific algorithms and others rely upon tried and true debugging and performance monitoring techniques. Luckily, the Android platform comes with numerous free utilities to help track down and eradicate performance problems within your applications. You've got 'em, now use 'em!
About the Authors
|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.|