Is it possible to add views dynamically to an XML based layout?
<p>Lets say that I have a simple XML layout such as the following:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout android:id="@+id/my_container"
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"&gt;
    &lt;LinearLayout android:id="@+id/leftContainer"
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"&gt;
        &lt;TextView android:layout_width="fill_parent"
            android:layout_height="wrap_content"
           android:text="Col A - Text 1"
        /&gt; 
    &lt;/LinearLayout&gt;
    &lt;LinearLayout android:id="@+id/rightContainer"
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"&gt;
        &lt;TextView android:layout_width="fill_parent"
            android:layout_height="wrap_content"
           android:text="Col B - Text 1"
        /&gt; 
    &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>Then I want to add a TextView to the rightContainer LinearLayout.  I am currently doing this, unsuccessfully:</p>

<pre><code>LinearLayout container = (LinearLayout) findViewById(R.id.rightContainer);
TextView textToAdd = new TextView(this);
textToAdd.setText("Col B - Text 2");
container.addView(textToAdd);
</code></pre>

<p>I have looked at LayoutInflater, but am not sure how I would use it here.  Any help would be appreciated, thanks!  If I try calling setContentView(container), I receive a Force Close error.</p>
