Questions tagged [oncreateoptionsmenu]

112 questions
0
votes
0 answers

onCreateOptionsMenu not called in fragment when using fragment transaction. Will appear when fragment is included in XML

I have a menu created that I am trying to display in my Fragment. Everything works well if the fragment is included in the activities xml layout file. But if I try to add the fragment to the frameLayout via fragment transaction without changing any…
0
votes
1 answer

How do you get a switch statement in android to recognize a checkbox?

I would like to clean up my code and have my checkbox do some actions from the switch statement inside onOptionsItemSelected(). Instead, I have an onClick listener in onCreateOptionsMenu for my custom checkbox. This works, but I would like to…
0
votes
1 answer

OnCreateOptionsmenu called once in viewpager with tablayout

I have a rare problem. I have an activity that has tabs populated dynamically (up to 20 tabs). Each fragment has an implementation of OnCreateOptionsMenu and a menu which contains a bookmark icon that changes color when pressed. There is a class…
0
votes
1 answer

error: method does not override or implement a method from a supertype OnCreateOptionsMenu

@Override public boolean OnCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return true; } @Override public boolean OnOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case…
0
votes
1 answer

Adding icon with my overflow menu features

I have a fetch function and I'm trying to call it in onCreateOptionsMenu(Menu menu, MenuInflater inflater) for filling the menu in real time. This function is working perfectly in the overflow menu but is not working in my switch block. I'm trying…
N. Tuba
  • 40
  • 1
  • 9
0
votes
0 answers

in onCreateOptionsMenu, onQueryTextChange(String newText) Return Wrong Position on Listview..setOnItemClickListener at ArrayAdapter

Respectable Gurus Bellow code return wrong position and data by clicking on listview filtered Item of ArrayAdapter, Any Suggestion will by highly appreciated. Listview easily and perfectly filtered but it returns Wrong position. Any Suggestion will…
0
votes
2 answers

onCreateOptionsMenu crashes only on Oreo

EDIT: Problem solved after upgrading Build Tools Version from 23 to 27. I have the following code snippet: @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); …
Cililing
  • 4,303
  • 1
  • 17
  • 35
0
votes
2 answers

Unable Override onCreateOptionsMenu in my Main_Activity

Two days ago, I switched switched from xamarin to android studio and I'm extremly new to Java. I'm trying to create a DrawerLayout with a NavigationView but once I try to override onOptionsItemSelected it simply don't wanna come. So what should I…
Tamim Attafi
  • 2,253
  • 2
  • 17
  • 34
0
votes
1 answer

I want to show ActionBar menu when Device orienation is changed

I am trying to show the ActionBar Menu in fragments, When device orientation is changed from portrait to landscape or vice versa Menu is dismissed. I want to show menu when device orientation is also changed. I don't want to provide a…
0
votes
1 answer

Change popup menu item title android

I am new to android development, i m trying to change the popup menu item title. i m using onCreateOptionsMenu() , but its not changing the title. how to achieve this? code included... MovieDetailsActivity.java public class MovieDetailsActivity…
Jaswinder
  • 361
  • 2
  • 11
0
votes
1 answer

Why does onCreateOptionsMenu(Menu menu) return a boolean?

I'm confused as to why it returns a boolean here when within the last line of code. What's the use of this and why does it matter? @Override public boolean onCreateOptionsMenu(Menu menu) { return super.onCreateOptionsMenu(menu); }
Adam J
  • 183
  • 2
  • 14
0
votes
0 answers

How dynamically add contents to menu item?

I am creating application where in top menu bar i created a wallet icon with balance on it! i retrieve balance from my prefrence!! But whenever i get a new update in balance from server, i need to update the balance in menu icon! How could i achieve…
user6761138
0
votes
0 answers

How can one implement OnCreateOptionsMenu outside of Activity

I have been searching on the web for something like this and have had no luck just one reference but that only suited the user who posted it . I have a class called OptionsMenu which extends AppCompatActivity and implements the OnCreateOptionsMenu .…
0
votes
1 answer

How to add two onCreateOptionsMenu(Menu menu) in android studion

I am creating an android app in which I have all ready added a share option to share content of the app, but I want to add another share option which will be able to share app download link (share this app), both the options use on create option…
sagar chaudhary
  • 33
  • 1
  • 12
0
votes
1 answer

Overrdding the OnCreateOptionsMenu method

I'm currently trying to create a basic action bar in my app. I'm trying to override the onCreateOptionsMenu method in my Main Activity but am getting an error that "method does not override or implement a method from a supertype". However, I see in…