How to have a button in between the preference layout
<p>I have to have a button in between preference layout.</p>

<p>The preference layout I am creating from java as </p>

<pre><code>    public PreferenceScreen createPreferenceHierarchy() {

    root = getPreferenceManager().createPreferenceScreen(this);
    root.setKey("root");
    rootAdapter = (BaseAdapter)root.getRootAdapter();

    WFCpref = new CheckBoxPreference(this);         
    WFCpref.setKey(wfckey);
    WFCpref.setChecked(true);
    WFCpref.setSummary(R.string.wfc_not_active);
    WFCpref.setTitle(R.string.myapp_app_name);
    root.addPreference(WFCpref);

    connectNow = getPreferenceManager().createPreferenceScreen(this);
    connectNow.setKey(manualconnectkey);
    connectNow.setLayoutResource(R.layout.manual_connect);
    connectNow.setEnabled(true);
    connectNow
        .setOnPreferenceClickListener(new OnPreferenceClickListener() {

            public boolean onPreferenceClick(Preference preference) {
                    Toast.makeText(getBaseContext(),
                                    "The custom preference has been clicked",
                                    Toast.LENGTH_LONG).show();
                    return true;
            }

        });


    root.addPreference(connectNow); 

    ManCalLoc = getPreferenceManager().createPreferenceScreen(this);
     ManCalLoc.setKey(mancallockey);
     ManCalLoc.setTitle("myapp_app_name Locations");
     ManCalLoc.setSummary("Enable myapp_app_name on specific locations");           
     root.addPreference(ManCalLoc);         


    WiFiset =  getPreferenceManager().createPreferenceScreen(this);
    WiFiset.setKey(wifikey);
    WiFiset.setTitle(R.string.myapp_wfSettingStr);
    WiFiset.setSummary(wifistatusStr);
    root.addPreference(WiFiset);

    HotSpotAsst = new CheckBoxPreference(this);
    HotSpotAsst.setKey(hotspotasstkey);
    HotSpotAsst.setTitle("myapp_app_name Assistant");
    HotSpotAsst.setSummary("myapp_app_name requiring login");
    HotSpotAsst.setChecked(false);
    root.addPreference(HotSpotAsst);            

    PreferenceScreen WFCHelp =  getPreferenceManager().createPreferenceScreen(this);
    WFCHelp.setKey(wfchelpkey);  
    WFCHelp.setTitle("myapp_app_name Help");  
    root.addPreference(WFCHelp);

     PreferenceScreen Tutorial =  getPreferenceManager().createPreferenceScreen(this);
    Tutorial.setKey("tutorial");
    Tutorial.setTitle(R.string.knt_str_Tutorial);
    root.addPreference(Tutorial);

        PreferenceScreen TopQuA =  getPreferenceManager().createPreferenceScreen(this);
        TopQuA.setKey("TopQAns");
        TopQuA.setTitle(R.string.knt_str_Top_Questions);
        root.addPreference(TopQuA);

        PreferenceScreen About =  getPreferenceManager().createPreferenceScreen(this);
        About.setKey("about");
        About.setTitle(R.string.myapp_aboutStr);
        root.addPreference(About);
    }
    return root;
   }



 where R.layout.manual_connect  is 




&lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:clickable="true"
  android:focusable="true"
  android:id="@+id/ManualConnect"
  &gt;
    &lt;TextView
        android:id="@+id/EmptytStart"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/&gt;        
      &lt;Button android:id="@+id/connectNow" 
        android:layout_height="wrap_content"
        android:layout_width="wrap_content" 
        android:textStyle="bold"
        android:textSize="18sp"
        android:layout_gravity="center" 
        android:ellipsize="marquee"
        android:drawablePadding="3dip"
        android:singleLine="true" 
        android:clickable="true"
        android:text="@string/str_Connect_Now" 
        android:focusable="true"/&gt;  
    &lt;TextView
        android:id="@+id/EmptytEnd"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/&gt;        
     &lt;/LinearLayout&gt;`
  With the above I am able to see button on the preferencescreen but , But the listener is  not getting called.
</code></pre>

<p>Any clue on the above is apreciated.</p>

<p>Thanks in advance.
Vani</p>
