ADT Template Format Documentation

If you've used ADT [1] to create a new Android project recently, you may have noticed that you have a few more options available for what type of UI you'd like to start with. For example, you can create an app with a simple activity containing an action bar and horizontally-swipeable tabs, or an app containing a set of activities and fragments representing a master/detail flow.

The magic lies in the new ADT templates that +Tor Norbye and I have been working on for the past few months in AOSP. Now, the current set of available templates in ADT 20 is just the beginning, and in the ADT 21 previews [2] you've seen a preview of the next set of templates in progress.

But what if you wanted to build your own templates, or integrate templates into your shell scripts or alternative IDE? Well, we now have formal documentation about the template format and syntax, published alongside the 'official' templates right in AOSP:


Since Google's git hosting doesn't offer viewing the raw HTML, I've also taken the liberty to temporarily mirror the latest version of the doc here using Dropbox:


If you'd like to build your own templates for ADT (i.e. for use within your own team), simply create a template directory following this format (take a look at the official ones [3] for examples) and drop it in <sdk>/extras/templates/. It'll then show up in Eclipse under New > Android Object alongside the official ones, after a restart.

It's also worth noting that the templates are decoupled from ADT and don't have any strict dependencies on Eclipse. So if you're the developer of an alternative Android IDE, feel free to implement this format… and of course let us know if you have any questions or suggestions regarding the syntax or template structure.

Thanks, and happy templating!

[1] http://tools.android.com/
[2] http://tools.android.com/preview-channel
[3] https://android.googlesource.com/platform/sdk/+/refs/heads/master/templates/
2 Photos - View album
Shared publiclyView activity