to top

Best Practices for Performance

These classes and articles help you build an app that's smooth, responsive, and uses as little battery as possible.

  1. Performance Tips

    How to optimize your app's performance in various ways to improve its responsiveness and battery efficiency.

    1. Improving Layout Performance

      How to identify problems in your app's layout performance and improve the UI responsiveness.

      1. Optimizing Layout Hierarchies
      2. Re-using Layouts with <include/>
      3. Loading Views On Demand
      4. Making ListView Scrolling Smooth
    2. Running in a Background Service

      How to improve UI performance and responsiveness by sending work to a Service running in the background

      1. Creating a Background Service
      2. Sending Work Requests to the Background Service
      3. Reporting Work Status
    3. Loading Data in the Background

      How to use CursorLoader to query data without affecting UI responsiveness.

      1. Running a Query with a CursorLoader
      2. Handling the Results
    4. Optimizing Battery Life

      How to minimize the amount of power your app requires by adapting to current power conditions and performing power-hungry tasks at proper intervals.

      1. Monitoring the Battery Level and Charging State
      2. Determining and Monitoring the Docking State and Type
      3. Determining and Monitoring the Connectivity Status
      4. Manipulating Broadcast Receivers On Demand
    5. Sending Operations to Multiple Threads

      How to improve the performance and scalability of long-running operations by dispatching work to multiple threads.

      1. Specifying the Code to Run on a Thread
      2. Creating a Manager for Multiple Threads
      3. Running Code on a Thread Pool Thread
      4. Communicating with the UI Thread
    6. Keeping Your App Responsive

      How to keep your app responsive to user interaction so the UI does not lock-up and display an "Application Not Responding" dialog.

      1. JNI Tips

        How to efficiently use the Java Native Interface with the Android NDK.

        1. SMP Primer for Android

          Tips for coding Android apps on symmetric multiprocessor systems.