Howto add onclick event to button in listview added by addheaderView?
<p>I'm using a listview. Before adding the main list items to the listview, i add a header with  to the listview using addheaderview(v). header have two buttons.</p>

<p>In logcat..it gives problem at 
btnhome.setOnClickListener(new View.OnClickListener() {</p>

<p>and it force close.
plz help me where is error in below code.</p>

<p>waiting for your reply
thanx in advance</p>

<pre><code>enter code here
</code></pre>

<p>public void onCreate(Bundle savedInstanceState){</p>

<pre><code>        super.onCreate(savedInstanceState);
        setContentView(R.layout.games_by_category);

        Global globalclass=((Global)getApplicationContext());
        globalclass.setpageno(0);                   
        lstview =(ListView)findViewById(android.R.id.list);      

        LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);            
        View v = inflater.inflate(R.layout.header, null);
        //View v = getLayoutInflater().inflate(R.layout.header, null);
        v.setMinimumHeight(10);
        lstview.addHeaderView(v);

        btnhome=(Button)findViewById(R.id.btnHome);
        btnhome.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) 
            {
                btnhome.setTextColor(Color.BLACK);
                Global globalclass=((Global)getApplicationContext());
                Intent inte=new Intent(GamesByCatActivity.this,HotGamesActivity.class);
                startActivity(inte);                    
          }
        });
</code></pre>
