title: Android app settings not showing up
body: <p>I am writing an Android app and I want to give the user a few settings that they can customize. However, whenever I go to press the Settings button in the overflow, it does not load the settings and my app crashes.</p>
  
  <p>Here is my menu and menu switcher code:</p>
  
  <pre><code>@Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  public boolean onOptionsItemSelected(MenuItem item) {
      switch(item.getItemId()) {
          case R.id.action_settings:
              Intent intent = new Intent(this, SettingsActivity.class);
              startActivity(intent);
              return true;
      }
      return super.onOptionsItemSelected(item);
  }
  </code></pre>
  
  <p>Here is the setting activty:</p>
  
  <pre><code>public class SettingsActivity extends Activity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
      }
  }
  </code></pre>
  
  <p>Here is the preferences fragment:</p>
  
  <pre><code>public class SettingsFragment extends PreferenceFragment {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          addPreferencesFromResource(R.xml.preferences);
      }
  } 
  </code></pre>
  
  <p>Is there another way I am supposed to handle the settings page? I followed the instructions from the Android Developer site. </p>
  
  <p>On a quick side note, how do I store those settings and access them in the main activity?</p>