Icons in the actionbar do not appear

-1

I have a fragment and I'm putting these two methods in the class

 @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
    menuInflater.inflate(R.menu.alerta, menu);
    super.onCreateOptionsMenu(menu, menuInflater);
  }

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_item_new_quote:
            // TODO put your code here to respond to the button tap
            Toast.makeText(getActivity(), "ADD!", Toast.LENGTH_SHORT).show();
            return true;
        default:
            return true;
    }
}

I have an xml file that I created in the menu folder

    

But the icons do not want to appear in the actionbar at all ...

    
asked by anonymous 02.02.2017 / 20:10

2 answers

0

Solved my problem by putting onCreate ():

 setHasOptionsMenu(true);
    
02.02.2017 / 20:45
-1

Try to take this super:

super.onCreateOptionsMenu(menu, menuInflater);
    
02.02.2017 / 20:44