in Education by
(This post isn't helpful) I'm using this code in onCreateOptionsMenu to enable/disable menu items in a fragment: @Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater) { inflater.inflate(R.menu.menu_main,menu); this.menu = menu; inflater.inflate(R.menu.menu_main, menu); assert ((AppCompatActivity)getActivity()).getSupportActionBar() != null; ((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(inEditMode); menu.findItem(R.id.signOut).setVisible(!inEditMode); menu.findItem(R.id.edit).setVisible(inEditMode); menu.findItem(R.id.delete).setVisible(inEditMode); menu.findItem(R.id.info).setVisible(inEditMode); } However, even when inEditMode is false, all of the Menu Items are visible. This is inside a fragment, which I am using via ViewPager. Here's my AppCompatActivity's XML: <?xml version="1.0" encoding="utf-8"?> I'm not setting a Toolbar in my Fragment; I only have my Toolbar in the Activity. Should I set my Toolbar in every Fragment? If not, why is this issue occuring and how can I fix it? This worked before I converted my AppCompatActivity to Fragment JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
It turns out I had to add: super.onCreateOptionsMenu(menu,inflater); Not sure why this is needed in Fragments but not in Activitys

Related questions

0 votes
    (This post isn't helpful) I'm using this code in onCreateOptionsMenu to enable/disable menu items in a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    I have a Fragment1, and i am make newInstance of Fragment1 and start in Fragment1, i.e. my ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 19, 2022 in Education by JackTerrance
0 votes
    First of all, thats my current state of play: thsbrk.de. The black boxes should be e.g. a about ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    First of all, thats my current state of play: thsbrk.de. The black boxes should be e.g. a about ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 9, 2022 in Education by JackTerrance
0 votes
    First of all, thats my current state of play: thsbrk.de. The black boxes should be e.g. a about ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I've followed all guides and answers, and everything displays correctly, but the actual upload doesn't ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 7, 2022 in Education by JackTerrance
0 votes
    I've followed all guides and answers, and everything displays correctly, but the actual upload doesn't ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I'm trying to install a GoDaddy SSL certificate on a new load balancer I'm setting up on Amazon AWS. I ... verify this. Any ideas? Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    I'm trying to incorporate Google Maps into my Access form so that for every record a map of its ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    I have two forms: frmClient', (which has a subform that lists applicants), and frmDisclosure', which ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    Using Eclipse 3.6SR2 and the appropriate Google Plugin I create a new Web Application Project. Everything ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    i have .htaccess file which includes below code. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I am trying to inflate one of my fragments. However, the fragment does not show up in the autosuggest ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    I'm a newbie in C# bu I'm experienced Delphi developer. In Delphi I can use same code for ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm a newbie in C# bu I'm experienced Delphi developer. In Delphi I can use same code for ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 18, 2022 in Education by JackTerrance
...