title: LinearLayout returns null when creating it dynamically
body: <p>I have two xml files in the layout folder <code>main.xml</code> and <code>hidden.xml</code>. in my activity, the content view is set to <code>main.xml</code> using <code>setcontentview</code>. what I want to do is, to inflate the <code>main.xml</code> with <code>hidden.xml</code> when a certain button is pressed. To accomplish this, I wrote the below posted code.</p>
  
  <p>But the problem is,  while checking if the <code>LinearLayout</code> is null or not, it returns null as the <code>toast</code> displays a respective message.</p>
  
  <p>My question is, what can cause a <code>LinearLayout</code> to be <code>null</code> since it is available in the <code>hidden.xml</code> ?</p>
  
  <p>JavaCode:</p>
  
  <pre><code>public void onClick(View v) {
          // TODO Auto-generated method stub
  
          switch (v.getId()) {
          case R.id.addBtn00:
              LinearLayout hiddenLinearLayout = (LinearLayout) findViewById(R.id.hiddenLayout00);
              if (hiddenLinearLayout == null) {
                  Toast.makeText(getBaseContext(), "hidden layout is null", Toast.LENGTH_SHORT).show();
              }else {
                  LinearLayout myLinearLayout = (LinearLayout) findViewById(R.id.linearLayout01);
                  View hiddenInfo = getLayoutInflater().inflate(R.id.hiddenLayout00, myLinearLayout,false);
                  myLinearLayout.addView(hiddenInfo);
              }
              //TextView mTv = (TextView) findViewById(R.id.textView00);
              //mTv.setText("This is not the original Text");
              break;
  
          case R.id.removeBtn00:
              break;
  
          default:
              break;
          }
  </code></pre>
  
  <p>hidden.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" 
  android:layout_width="match_parent"
  android:layout_height="match_parent" 
  android:id="@+id/hiddenLayout00"&gt;
      &lt;TextView 
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:text="This is a Text View" 
          android:layout_height="wrap_content"
          android:id="@+id/textView00" 
          android:layout_width="wrap_content" /&gt;
  </code></pre>