XML to Java code in Android
<p>what i want to do converting xml to android code.</p>

<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity" &gt;

    &lt;TextView
        android:id="@+id/screen"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" /&gt;

    &lt;LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" &gt;

        &lt;Button
            android:id="@+id/connectBtn"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Connect" /&gt;

        &lt;TextView
            android:id="@+id/space"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" /&gt;

        &lt;Button
            android:id="@+id/disconnectBtn"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Disconnect" /&gt;
    &lt;/LinearLayout&gt;

    &lt;LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" &gt;

       &lt;Button 
           android:id="@+id/btn1" 
           android:layout_width="0dp"
           android:layout_height="wrap_content"
           android:layout_weight="1"
           android:text="@string/btn1_txt" /&gt;

        &lt;Button 
           android:id="@+id/btn2" 
           android:layout_width="0dp"
           android:layout_height="wrap_content"
           android:layout_weight="1"
           android:text="@string/btn2_txt" /&gt;

         &lt;Button 
           android:id="@+id/btn3" 
           android:layout_width="0dp"
           android:layout_height="wrap_content"
           android:layout_weight="1"
           android:text="@string/btn3_txt" /&gt;
        &lt;/LinearLayout&gt;
</code></pre>

<p>Above code needed to convert to java code.</p>

<p>To do that, i need to create multiple linear layout in java. Is that the correct way? If not what is the correct way?</p>
