Android 2.2 was unveiled a few days ago at Google I/O and the SDK is now available for download. Android 2.2 offers numerous improvements and new features and there is one I would like to talk about in detail, the new Capture PSD tool.
Capture PSD can be found in HierarchyViewer and requires an emulator or phone running at least Android 2.2. If you are not familiar with HierarchyViewer, I encourage you to give it a try right now. It is an extremely useful tool to inspect and debug user interfaces on Android devices. The screenshot below shows where you can access this new feature; after loading a view hierarchy, simply press the Capture PSD button in the toolbar:
With Capture PSD you can generate a Photoshop file from a running Android application. The generated document contains every view that draws as a separate layer. This can be very useful to quickly see what your UI would look like if you moved things around for instance. It is also an easy way to work with designers and let them try out new concepts in existing user interfaces. Of course, it is also a fine way to see how other applications are put together and understand how to achieve similar UI patterns. In the following examples, I exported a PSD file from the Android Market application and changed the UI a little bit to see what it would look like with the tabs at the top:
Each layer is named either after the id of the corresponding view, or after the class name of the view. Views in the invisible state are exported but their layers are hidden by default, as shown in the following screenshot:
The exported files are kept as simple as possible to ensure compatibility with as many applications as possible. For instance, recent versions of GIMP can open the generated documents without any problem. Finally, know that the generated files are not compressed and can therefore be quite large.