Is there any xml-include-like thing for Java class?
<p>When we make Android layout in XML, we can use <code>include</code> to make some other layout the part of the host layout. Is there such thing for Java class?</p>

<p>I am attaching a top bar layout to every screen and it contains buttons. Now in every Java class I have to copy/paste the initialization code. </p>

<p>Is there any shortcut for such scenarios? Can <code>Application</code> class facilitate anyhow? If anyone has a working solution, please share it with me.  </p>

<p>For example, in XML I can use</p>

<pre><code>//...xml layout elements
&lt;include layout="@layout/topbar" /&gt;
//...some other xml layouts
</code></pre>

<p>so it would be cool to be able to use in Java code something where I could instantly initiate buttons, register <code>onClick</code> events and set actions to these events. It all the same piece of code I am using, after all. </p>
