title: I get a NullPointerException when i try to modify the height of a layout in onTabSelected()
body: <p>Here is my quite simple problem:</p>
  
  <p>I get a NullPointerException when i try to modify the height of a layout in onTabSelected().</p>
  
  <p>Here is the code:</p>
  
  <pre><code>import...
  
  public class MainActivity extends Activity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          ...
          tab1.setTabListener(new MyTabListener(fragmentTabCustom));
          actionBar.addTab(tab1);
      }
      ...
      public void changeFragmentTabCustom() {
          runOnUiThread(new Runnable() {
              @Override
              public void run() {    
                  layout1 = (LinearLayout) findViewById(R.id.layoutdefault);
                  layout1.getLayoutParams().height = 0; // the exception appends on this line
                  layout1.setLayoutParams(layout1.getLayoutParams());
              }
          }
      }
      ...
  }
  
  public class MyTabListener implements ActionBar.TabListener {
      ...
      @Override
      public void onTabSelected(Tab tab, FragmentTransaction ft) {
          mainActivity.changeFragmentTabCustom();
          ...
      }
  }
  </code></pre>
  
  <p>What is wrong?</p>