0

All of my activities have no onCreateOptionsMenu or related methods. I deleted the menu.xml and all related ones as well. I still see the options menu on the right side of the bottom bar. Any ideas why this might occur? Min SDK is 10 and the device is Nexus 5 5.0.

rasmeta
  • 465
  • 2
  • 12
Barışcan Kayaoğlu
  • 1,294
  • 3
  • 14
  • 35

1 Answers1

1

You need to set your targetSdkVersion to 11 or higher to get rid of the legacy action overflow button.

Changing minSdkVersion to >=11 works too, but is not strictly necessary.

laalto
  • 150,114
  • 66
  • 286
  • 303
  • Is there a way to remove it programmatically without changing the minSDK version of the app? – Barışcan Kayaoğlu Jul 24 '15 at 08:14
  • Just change `targetSdkVersion`, no need to touch `minSdkVersion`. – laalto Jul 24 '15 at 08:14
  • Ahh yes.. Well its kinda sad to see target SDK affects application's behavior like this. Now I can compile and run methods that require higher min SDKs. Anyway, thanks for the answer :) – Barışcan Kayaoğlu Jul 24 '15 at 08:24
  • That's the point of `targetSdkVersion` - to provide backwards compatibility to apps that are not tested to work with newer versions. Prior to API level 11 all devices had hardware menu button and the system needs to emulate it for apps that don't declare to target API level 11 or higher. – laalto Jul 24 '15 at 08:26
  • Yes but then why the ides allow to use methods require higher SDK then the minSDK... It is obvious that it will not work on the lower versions. – Barışcan Kayaoğlu Jul 24 '15 at 08:34
  • You can use whatever there is in your `compileSdkVersion`. Only call them at runtime when you've verified the device API level is high enough. Pay attention to Android Lint errors about API levels, too. – laalto Jul 24 '15 at 08:38