title: How to add ToolBar in PreferenceActivity?
body: <p>I want to add <code>ToolBar</code> in <code>PreferenceActivity</code> in my android application. I wrote the following code.</p>
  
  <pre><code>  public class SettingsActivity extends PreferenceActivity  {
   SendSMS sms;
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.settings);
      LinearLayout root = (LinearLayout)findViewById(android.R.id.list).getParent().getParent().getParent();
      android.support.v7.widget.Toolbar bar = (android.support.v7.widget.Toolbar) LayoutInflater.from(this).inflate(R.layout.action_bar_setting, root, false);
      root.addView(bar, 0);
      bar.setNavigationOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              onBackPressed();
          }
      });
  </code></pre>
  
  <p>}</p>
  
  <p>This worked perfectly in my android <strong>Kitkat</strong> phone API 19 but force closed in API level 10 i.e. <strong>gingerbread</strong>. Please suggest me.</p>