how to set toolbar on FragmentActivity?
<p>I want to set <strong>toolbar</strong> on my activity which extends <strong>FragmentActivity</strong>. I know that for use <code>setSuppoertActionBar(toolbar)</code> method we extends <code>AppCompatActivity</code> instead of <code>FragmentActivity</code> but I override the <code>onMenuItemSelected(int featureId, MenuItem item)</code> method which is final in <code>AppCompatActivity</code> and final method cannot override. so I'm restricted to extends <code>FragmentActivity</code>.</p>

<p>Here is my code:</p>

<pre><code>public class MainActivity extends FragmentActivity
{
    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);   -&gt; error is here
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) 
    {
       // Inflate the menu
       getMenuInflater().inflate(R.menu.menu_main, menu);
       return true;
    }

    @Override
    public boolean onMenuItemSelected(int featureId, MenuItem item) {
        switch(item.getItemId()){
            case R.id.action_search:
                onSearchRequested();
                break;
        }
        return super.onMenuItemSelected(featureId, item);
    }
</code></pre>

<p>I saw many answers related to that question but everyone says extends <code>AppCompatActivity</code> instead of <code>FragmentActivity</code> but I want to set toolbar as well as override <code>onMenuItemSelected(int featureId, MenuItem item)</code> method.</p>

<p>what should I do, please help.</p>