title: Android preferences onclick event using sherlockpreferenceactivity
body: <p>hello am trying to implement an onclick event for CheckBoxPreference.
  In the folder res/xml/preferences.xml i have this preference:</p>
  
  <pre><code>&lt;CheckBoxPreference
  android:key="IsEnable"
  android:title="IsEnable"
  android:persistent="true"
  /&gt; 
  </code></pre>
  
  <p>i followed this answer on SO:
  <a href="https://stackoverflow.com/questions/5330677/android-preferences-onclick-event">Android preferences onclick event</a></p>
  
  <p>In the activity.java:</p>
  
  <pre><code>public class settingsActivity extends SherlockPreferenceActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  Preference myPref = (Preference) findPreference("IsEnable");
  myPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {//&lt;--compilation error
  public boolean onPreferenceClick(Preference preference) {
  //code goes here
  return true;
  }
  });
  }
  </code></pre>
  
  <p>But am getting the below compile error at the 7th line:
  Multiple markers at this line
      - OnPreferenceClickListener cannot be resolved to a type
      - The method setOnPreferenceClickListener(Preference.OnPreferenceClickListener) in the type Preference is not applicable for the 
       arguments (new OnPreferenceClickListener(){})</p>
  
  <p>Thank you for your help.</p>