title: how to change frame layout height and width programatically?
body: <p>I am new to android.</p>
  
  <p>I face one problem that is i am adding frame layout to my application the code is</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="fill_parent"
      android:layout_height="fill_parent"
      &gt;
      &lt;FrameLayout android:id="@+id/frameLayout1"&gt;
          &lt;LinearLayout 
          android:layout_height="wrap_content" 
          android:id="@+id/linearLayout1" 
          android:layout_width="fill_parent"&gt;
          &lt;/LinearLayout&gt;
      &lt;/FrameLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>My problem is i want to change the frame layout height in different screen orientations</p>
  
  <p>the sample code is</p>
  
  <pre><code>    wm = (WindowManager)getSystemService(Context.WINDOW_SERVICE);
  
              getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  
              Log.v("height","height"+wm.getDefaultDisplay().getHeight());
  
              if(wm.getDefaultDisplay().getHeight() &lt;= 427)
               {
                   Log.v("height","111");
  
  
  ((FrameLayout)findViewById(R.id.frameLayout1)).setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
           }
          else
          {
              ((FrameLayout)findViewById(R.id.frameLayout1)).setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
          }
  </code></pre>
  
  <p>But it gives force close ,</p>
  
  <p>if any one has idea please help me.</p>
  
  <p>Thanks in advance.</p>