title: How can I show a preferences screen on older Android devices i.e. Gingerbread and Froyo?
body: <p>I need to show a preferences screen from my application. I've managed to implement this and it works on Ice-Cream Sandwich and newer devices but doesn't work on older devices like Gingebread and Froyo. I'm using ActionBarSherlock as a compatibility library to support older devices.</p>
  
  <p>Here's the code for the <code>Activity</code> that contains the preference screen:</p>
  
  <pre><code>public class Settings extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);    
          getFragmentManager().beginTransaction()
                  .replace(android.R.id.content, new Preferences())
                  .commit();
      }
  
  }
  </code></pre>
  
  <p>This is the sample code from my activity that invokes the preferences screen:</p>
  
  <pre><code>public class Trend extends SherlockActivity {
  
      @Override
      public boolean onOptionsItemSelected(MenuItem itmMenuitem) {
          if (itmMenuitem.getItemId() == R.id.search) {
              startActivity(new Intent(getBaseContext(), Settings.class));
              return true;
          }
      }
  
  }
  </code></pre>
  
  <p>When users try and open the preferences screen on older devices, I get an exception that reads:</p>
  
  <pre><code>java.lang.NoSuchMethodError: com.mridang.stupidapp.Settings.getFragmentManager
  at com.mridang.stupidapp.Settings.onCreate(Settings.java:15)
  </code></pre>
  
  <p>How should I modify my preferences screen to work with older devices i.e. API 8? Thanks.</p>