Don't wait for your app to start throwing errors before you go looking for performance-related problems. Your app could be slowly leaking memory, allocating too many objects, or struggling under the weight of a complex view hierarchy. None of these will necessarily throw an error, but they'll definitely have a negative impact on your app's performance.
If you're going to create a high-performance app, you need to go looking for problems.
Timing your code is a powerful way of seeing exactly what's going on in your app, including any sections of code that are running slower or longer than others. The first Android SDK tool we're going to look at lets you do just that.
TraceView is a graphical viewer that can profile any Android app running on your device.
TraceView, like most of the tools we're going to cover in this chapter, can only measure a running application. So the first step is to install the app you want to test on your Android device, and then attach that device to...