By : Ketan Bhimani
228
Using the Hierarchy Viewer Tool
In addition to the Eclipse layout resource designer provided with
the Android plug-in, the Android Software Development Kit (SDK)
provides a user interface tool called the Hierarchy Viewer. You can
find the Hierarchy Viewer in the Android SDK subdirectory called
/tools.
The Hierarchy Viewer is a visual tool that enables you to inspect
your Android application’s View objects and their parent-child
relationships. You can drill down on specific View objects and
inspect individual View properties at runtime. You can even save
screenshots of the current application state on the emulator or the
device, although this feature is somewhat unreliable.
Do the following to launch the HierarchyViewer with your
application in the emulator:
- Launch your Android application in the emulator.
- Navigate to the Android SDK /tools directory and launch the Hierarchy
Viewer. - Choose your emulator instance from the Device listing.
- Select the application you want to view from the windows available. For
example, to load an application from this book, choose one such as the
ParisView project from Chapter Managing Application Resources. - Click Load View Hierarchy button on the menu bar.
By default, the Hierarchy Viewer loads the Layout View of your
application. This includes the parent-child view relationships shown
as a Tree View. In addition, a property pane shows the various
properties for each View node in the tree when they are selected. A
wire-frame model of the View objects on the screen is shown and a
red box highlights the currently selected view, which correlates to
the same location on the screen.