2t0m
2t0m

Reputation: 165

getActionBar from Fragment with AppCompatLibrary

I'm look for the easiest way to get an ActionBar instance from a Fragment using AppCompatLibrary and API 8.

Already tried things like

getActivity().getSupportActionBar() 

but no luck.

Upvotes: 7

Views: 9703

Answers (1)

BArtWell
BArtWell

Reputation: 4044

Try to cast it:

((YourActivity)getActivity()).getSupportActionBar()

Upvotes: 23

Related Questions