I want to set up my toolbar as an actionbar, but since your toolbar is a layoutelement it has to be in your layout. Now my layout is in my fragment.
I added the toolbar
Now ActionBarActivity
is deprecated so
You need to cast your activity from getActivity()
to AppCompatActivity
first. Here's an example:
((AppCompatActivity) getActivity()).getSupportActionBar().setSubtitle();
The reason you have to cast it is because getActivity()
returns a FragmentActivity
and you need an AppCompatActivity