title: Hide included layout in android
body: <p>I have to develop an android application.</p>
  
  <p>I have created one layout file that uses another layout file using the <code>include</code> tag.</p>
  
  <pre><code>  &lt;include
      android:id="@+id/footer"
      android:layout_width="match_parent"
      android:layout_height="60dp"
      android:layout_alignParentBottom="true"
      layout="@layout/footer_tabs" /&gt;
    &lt;include
      android:id="@+id/footer1"
      android:layout_width="match_parent"
      android:layout_height="60dp"
      android:layout_alignParentBottom="true"
      layout="@layout/footertabs" /&gt;
  </code></pre>
  
  <p>I would like to show the included layout when a response is null, otherwise I would like to hide the layout and show the other. Here is what I have so far:</p>
  
  <pre><code>footertabs = (RelativeLayout) findViewById(R.id.footertab);
  footer_tabs = (RelativeLayout) findViewById(R.id.footer_tab);
  
  if (Constants.response==null) {
      footertabs.setVisibility(View.VISIBLE);
      footer_tabs.setVisibility(View.GONE);
  }
  else
  {
      footertabs.setVisibility(View.GONE);
      footer_tabs.setVisibility(View.VISIBLE);
  }
  </code></pre>
  
  <p>But I'm getting the following error:</p>
  
  <pre><code>07-15 17:19:09.893: E/AndroidRuntime(15143): Caused by: java.lang.NullPointerException
  07-15 17:19:09.893: E/AndroidRuntime(15143):    at com.example.androidbestinuk.HomePage.onCreate(HomePage.java:56)
  </code></pre>
  
  <p>Please help me debug this error.</p>