This question is asked several times in stackoverflow and I have tried all of them. But unfortunately neither is working for me.
I am trying to implement the naviga
Summay: To make sure you won't get a NullPointerException. You need to:
But in my situation an if statement is necessary to solve my App from crash. By the way, I'm using an AppCompatActivity to hold my view fragment.
public onCreateView(LayoutInflater inflater, final ViewGroup container,Bundle savedInstanceState){
View view = inflater.inflate(R.layout.list_fragment, container, false);
ActionBar actionBar = getActivity().getActionBar();
if (actionBar != null){
actionBar.setDisplayHomeAsUpEnabled(true);
}