title: Android adding header to listview in fragment
body: <p>I am adding a drawable image as header in listview. I have implemented it as follows in case of an activity.</p>
  
  <pre><code>listView1 = (ListView)findViewById(R.id.listView1);
  
      View header = (View)getLayoutInflater().inflate(R.layout.header, null);
      listView1.addHeaderView(header);
  </code></pre>
  
  <p>However, now i am trying to implement the same in a viewpager fragment like this</p>
  
  <pre><code>import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  public class ShowFrag1 extends Fragment {
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, 
          Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View v=inflater.inflate(R.layout.frag1, container,false);
          ListView lv1=(ListView) v.findViewById(R.id.listView1);
  
          Level weather_data[] = new Level[]
                  {
                      new Level(R.drawable.s1, "L1", R.drawable.p),
                      new Level(R.drawable.s2, "L2",R.drawable.p),
                      new Level(R.drawable.s3, "L3",R.drawable.p),
                      new Level(R.drawable.s4, "L4",R.drawable.p),
                      new Level(R.drawable.s6, "L5",R.drawable.p)
                  };
          LevelAdapter adapter = new LevelAdapter(getActivity(),
                  R.layout.list_item, weather_data);
  
         View header = (View)getLayoutInflater().inflate(R.layout.header, null);
          lv1.addHeaderView(header);
  
          lv1.setAdapter(adapter);
          return v;
      }
  }
  </code></pre>
  
  <p>Now in this, i am getting an error "</p>
  
  <blockquote>
    <p>The method getLayoutInflater(Bundle) in the type Fragment is not
    applicable for the arguments ()</p>
  </blockquote>
  
  <p>" in the line </p>
  
  <pre><code>View header = (View)getLayoutInflater().inflate(R.layout.header, null);
  </code></pre>
  
  <p>How do i resolve this error?
  Thanks</p>