dynamically creating buttons vs creating it through xml file (static)?
<p>I am new to android programming.
I'd like to know which is a better way create ui elements like a button; defining them in the layout.xml or adding them at runtime through java like:</p>

<pre><code>public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    LinearLayout ll = new LinearLayout(this);
    mRecordButton = new RecordButton(this);
    ll.addView(mRecordButton,
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT,
            0));
</code></pre>

<p>Can some one explain its pros and cons ?</p>

<p>Thanks
Utsav.</p>
