 <p>Right. Actually, you don't use xml for functions (that would be torture). You put your xml layouts in the <code>/layout</code> folder and then refer to elements to do stuff (like add listeners/whatnot) by doing something like <code>Button yourButton = (Button) &lt;Activity instance&gt;.findViewByID(R.id.your_button)</code>. </p> <p>See: <a href="http://developer.android.com/guide/topics/ui/declaring-layout.html" rel="nofollow">http://developer.android.com/guide/topics/ui/declaring-layout.html</a></p> <p>And if you really don't like xml, you can just do everything in java...</p>