title: Fragment change height programmatically
body: <p>I was trying to change the height of a fragment programmatically.</p>
  
  <p>I could get the result in XML having the fragment layout height to 650dp;</p>
  
  <p>But I want to change that dynamically.</p>
  
  <p>Inside the onCreateView of fragment I wrote the below code which throws a NullPointerException - </p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
  {
      // Inflate the layout for this fragment
      View v = inflater.inflate(R.layout.fragment_group_info, container, false);
      try {
          ViewGroup.LayoutParams params = v.getLayoutParams();
          params.height = 610;
          v.setLayoutParams(params);
      } catch (Exception e) {
          Log.d("ListView1", "GroupInfoFragment Height Exception: " + e.toString());
      }
      mListView = (ListView) v.findViewById(android.R.id.list);
      rv =v;
      return v;
  }
  </code></pre>
  
  <p>the Exception -</p>
  
  <pre><code>GroupInfo Fragment Height Exception: java.lang.NullPointerException: 
  Attempt to invoke virtual method 'android.view.View android.app.Fragment.getView()' 
  on a null object reference
  </code></pre>