cannot load linear layout from main.xml in a dyanimic layout
<p>I am trying to make dynamic layout  in which there is a scroll view.
In the scroll view , I am adding vertical linear layout which references main.xml.
The code stops as soon , I try to add the layout referencing main.xml.     </p>

<pre><code> ScrollView scroll;
    EditText search;
    Button checkin;
        LinearLayout vt;

        public void onCreate(Bundle savedInstanceState) 
        {

            super.onCreate(savedInstanceState);
            scroll=new ScrollView(getApplicationContext());
            vt=(LinearLayout) findViewById(R.id.llv);///referencing linear layout located in main.xml.This is where problem the  is occurring.
            //vt.setOrientation(LinearLayout.VERTICAL);
            scroll.addView(vt);
            this.setContentView(scroll);
        }
</code></pre>

<p>main.xml ( where R.id.llv is located )</p>

<pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" &gt;



    &lt;LinearLayout
        android:id="@+id/llv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" &gt;
         &lt;TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" /&gt;

        &lt;ToggleButton
            android:id="@+id/toggleButton1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="ToggleButton" /&gt;

        &lt;Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" /&gt;
    &lt;/LinearLayout&gt;

&lt;/LinearLayout&gt;
</code></pre>
