So the other day I was working on a project. I looked at the xml and thought that it could use some refactoring. I went to use the hierarchyviewer in the android sdk. Unfortunately the tool wasn’t working with my phone. Turns out that it doesn’t work with production phones! You need root for it to work. Fortunately there is a project that allows even productions phones to work without needing root. It can be found here. I like hierarchyviewer’s easy to use interface. Each view is a node in the view. Each node has three circle indicators for Measure, Layout, and Draw methods in a view. The circles are colored green, yellow, and red to indicate speed. If you think a layout is slow you can at a high level go look for the red nodes. The red nodes give you a hint that their container View may be the culprit. After refactoring I was able to make my view load about 25% faster.

Leave a Reply

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