Android Adding OnClickListener to listview
<p>I have been trying to create a settings app for my new rom called "ProtoType" and i am trying to add an OnClickListener to my listview but i cant find the appropriate way to do so and as a result i have turned to here for help and i was wondering if anybody can show me how i'll post my activity below and thanks.</p>

<pre><code>package fr.xgouchet.tuto.switchpreferences;

import java.util.ArrayList;
import java.util.List;

import android.preference.PreferenceActivity;
import android.widget.ListAdapter;

public class MyPrefsActivity extends PreferenceActivity {

    private List&lt;Header&gt; mHeaders;

    protected void onResume() {
        super.onResume();

        setTitle("Settings"); 

        if (getListAdapter() instanceof MyPrefsHeaderAdapter)
            ((MyPrefsHeaderAdapter) getListAdapter()).resume();
    }

    protected void onPause() {
        super.onPause();
        if (getListAdapter() instanceof MyPrefsHeaderAdapter)
            ((MyPrefsHeaderAdapter) getListAdapter()).pause();
    }

    public void onBuildHeaders(List&lt;Header&gt; target) {
        // Called when the settings screen is up for the first time
        // we load the headers from our xml description

        loadHeadersFromResource(R.xml.my_prefs_headers, target);

        mHeaders = target;
    }

    public void setListAdapter(ListAdapter adapter) {
        int i, count;


        if (mHeaders == null) {
            mHeaders = new ArrayList&lt;Header&gt;();
            // When the saved state provides the list of headers,
            // onBuildHeaders is not called
            // so we build it from the adapter given, then use our own adapter

            count = adapter.getCount();
            for (i = 0; i &lt; count; ++i)
                mHeaders.add((Header) adapter.getItem(i));
        }

        super.setListAdapter(new MyPrefsHeaderAdapter(this, mHeaders));



















    }

}
</code></pre>
