O'Reilly logo

Android 3.0 Animations by Alex Shaw

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—tracing to find optimizations

So far, we have identified a problem: our animation is really power hungry. This is not good. We must find out where the program is doing work that it doesn't need to. The steps for it are as follows:

  1. In the BuggyBubbles project, navigate to the file src/com/packt/animation/buggybubbles/BuggyBubblesActivity.java and add the following new import statement:
    import android.os.Debug;
    

    I'm sure it will come as no surprise to learn that this class provides debugging capabilities.

  2. Next up, add a new line to the onCreate method in BuggyBubblesActivity, such as the following:
    public void onCreate(Bundle savedInstanceState)
    {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Debug.startMethodTracing("buggybubbles"); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required