listView.addHeaderView() giving "null pointer exception"
<p>I have a requirement that I need to add header to my list view .</p>

<p>Below is my code for achieve the same..</p>

<pre><code>     ListView listView;
     listView = (ListView) findViewById(R.id.list_view);
     //View header = View.inflate(this  , R.layout.header, null);
     LayoutInflater ll = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     View v2 = ll.inflate(R.layout.header, null, false);


    listView.addHeaderView(v2);
</code></pre>

<p>But  "listView.addHeaderView(v2)" this line giving "null pointer exception"</p>

<p>Please let me know what can be done to resolve this issue.</p>
