Android hierarchy viewer red dots

Android-hierarchy-viewer-red-dots-featured.png

Android SDK comes with many tools that will help developers to make their apps better. In this post I will be discussing one such tool called “hierarchyviewer”. It is located in /tools folder.

Each view, widget and layout in an application requires initialization, layout, and drawing. If we use nested instances of LinearLayout, it can lead to an excessively deep view hierarchy. Also, nesting several instances of LinearLayout that use the layout_weight parameter can be especially expensive as each child needs to be measured twice. This is particularly important when the layout is inflated repeatedly, such as when used in a ListView or GridView.

Hierarchy Viewer allows developer to analyze the layout while the application is running. Using this tool one can discover bottlenecks in the layout performance.It works by allowing you to select running processes on a connected device or emulator, then display the layout tree.

Note:To preserve security, Hierarchy Viewer can only connect to devices running a developer version of the Android system.
Who Should Use this Tutorial ?
This tutorial is designed for experienced developers , especially those with knowledge of the android framework, who have already build some Android phone apps. It focuses on how hierarchyviewer tool can be used to optimize layout and hence performance. If you haven’t written android applications before, you can still use the tutorial, but you might need to work at a slower pace.
Preparing for the Exercises:
The tutorial assumes that you have some familiarity with basic Android application concepts and terminology. If you are not, you should read Application Fundamentals before continuing. You will need [Android Platform 2.2 along with SDK Tools Revision 20.0.1 and ADT 20.0.2] Tools and ADT for this exercise.
To prepare for this lesson:

Download the Project Exercises Archive (.zip).
Unpack the archive file to a suitable location on your machine.
Import the projects in eclipse.

If you are having trouble with the exercise, you can compare your current work against the checkpoint.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>