Can't get Action Bar in fragment class
@Robert Estivil
If you are using AppCompatActivity
then use this:
actionBar = ((AppCompatActivity)getActivity()).getSupportActionBar();
A static class cannot see private fields of another class. You will need to use getActivity().getActionBar()
to retrieve it.
Though i am late in answering here. I found arul's answer perfect, but now ActionbarActivity is deprecated so slight modification to that answer will finish the job:
ActionBar actionBar = ((AppCompatActivity)getActivity()).getSupportActionBar();