How I can remove this button? Android API 17.
Asked
Active
Viewed 3,679 times
0
-
Are you targeting API 17? Are you using an ActionBar? – Darkhogg Oct 28 '13 at 15:33
-
http://stackoverflow.com/questions/10692755/how-do-i-hide-a-menu-item-in-the-actionbar ? – Bram Oct 28 '13 at 15:33
-
@Bram that's not the question, actually. – Darkhogg Oct 28 '13 at 15:35
-
Targeting API 17, without ActionBar. – master_Alish Oct 28 '13 at 15:49
3 Answers
2
remove @Override public boolean onCreateOptionsMenu(Menu menu) {}
and
@Override public boolean onOptionsItemSelected(MenuItem item) {}

Dima
- 158
- 6
-
-
I tried `@Override public boolean onOptionsItemSelected(MenuItem item) { item.setVisible(false); System.out.println("MENU ITEM : DISABLED"); return true; }` This code is never executed – master_Alish Oct 28 '13 at 15:46
-
-
2
Set your android:targetSdkVersion
to 14 or higher. See also the "Say Goodbye to the Menu Button" post from the Android Developers Blog.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
0
You can override these methods, if removing them didn't work for you.
public boolean onCreateOptionsMenu (Menu menu){
// do nothing here. Leave it as it is.
}
public boolean onOptionsItemSelected (MenuItem item){
// do nothing here.
}

CopsOnRoad
- 237,138
- 77
- 654
- 440