O'Reilly logo

Pro Android Apps Performance Optimization by Hervé Guihot

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

Optimizing Layouts

By now you should already be familiar with XML layouts and the setContentView() method. A typical use of this method is shown in Listing 8–1. Even though many consider layouts to be simple to define, especially with the graphical layout interface in Eclipse, it is easy to get carried away and define far from optimal layouts. This section provides several easy ways to simplify layouts and accelerate layout inflation.

Listing 8–1. Typical setContentView() Call

public class MyActivity extends Activity {     private static final String TAG = "MyActivity";     /** Called when the activity is first created. */     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         // ...

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