title: Add buttons to PreferenceFragment
body: <p>I want to add a couple buttons to the bottom of my preferences screen for setting defaults and restoring defaults. <a href="https://stackoverflow.com/questions/2697233/how-to-add-a-button-to-preferencescreen">This</a> answer doesn't cover how to do this using PreferenceFragment. What is the recommended way to accomplish this.</p>
  
  <p>Activity that loads the preferences fragment:</p>
  
  <pre><code>public class SettingsActivity extends Activity {
  
      @Override
      public void onCreate( Bundle savedInstanceState) {
  
          super.onCreate( savedInstanceState);
  
          // load up the preferences fragment
          getFragmentManager().beginTransaction().replace( android.R.id.content, new PrefsSettingsFragment()).commit();
      }
  }
  </code></pre>
  
  <p>PreferenceFragment implementation:</p>
  
  <pre><code>public class PrefsSettingsFragment extends PreferenceFragment {
  
      @Override
      public void onCreate( Bundle savedInstanceState) {
  
          super.onCreate( savedInstanceState);  
  
          addPreferencesFromResource( R.xml.preferences);             
      }       
  }
  </code></pre>
  
  <p>preferences.xml:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;EditTextPreference android:key="edit_text_preference_server_address" android:title="@string/preference_server_address"/&gt;
      &lt;SwitchPreference android:key="switch_preference_bat" android:title="@string/preference_bat"/&gt;
      &lt;SwitchPreference android:key="switch_preference_comm" android:title="@string/preference_comm"/&gt;
      &lt;SwitchPreference android:key="switch_preference_dev_mode" android:title="@string/preference_dev_mode" android:defaultValue="true"/&gt;
  
  &lt;/PreferenceScreen&gt;
  </code></pre>