what is the advantage of using xml for layout?
<p>I've been through a few tutorials etc and have found that I can acheive the same results defining all of my UI components in code.</p>

<p>for example</p>

<pre><code>@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    TextView tv = new TextView(this);
    tv.setText("hello");
    LinearLayout ll = new LinearLayout(this);
    ll.addView(tv);
    setContentView(ll);
}
</code></pre>

<p>is the equivalent of </p>

<pre><code>@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}
</code></pre>

<p>+</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/textview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:text="@string/hello"/&gt;
</code></pre>

<p>What are the performance/maintainability benefits of using XML for this?</p>

<p>If a programmer prefers to use code over XML what extra considerations should be made?</p>

<p>Cheers, p.</p>
