Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Options menu won't show in Android 4.1.1

Tags:

android

menu

I have a Google Nexus 7 tablet, which runs Android 4.1.1, and I can't seem to get my app to display the little "three tiny squares in a vertical line" symbol on the lower right indicating that there's an options menu available. My build, targeted at 2.3.3, will display an options menu on other devices (a 2.3.3 phone and a 4.0.3 phone), but not on the Nexus 7. To illustrate the problem, I used Eclipse to build both a bare-bones "Hello World", which comes with a single option menu item, 'Settings', and also built the BluetoothChat example from the Android-10 SDKs. The barebones one doesn't have the menu symbol, while the BluetoothChat does. Looking at the code for each, I can't see a difference in how the menus are handled as far as construction and inflation, so I'm hoping somebody has some ideas. Good menu icon: http://i.imgur.com/31Wop.jpg No menu icon: http://i.imgur.com/9Vj3e.jpg

like image 805
John Jorsett Avatar asked Dec 06 '22 12:12

John Jorsett


1 Answers

Found the problem. In the manifest I had

<uses-sdk
    android:minSdkVersion="10"
    android:targetSdkVersion="15" />

Changing that to

<uses-sdk
    android:minSdkVersion="10"
    android:targetSdkVersion="10" />

fixed the problem and now the menu button on the ActionBar appears. The BluetoothChat sample worked because its manifest omitted the targetSdkVerion:

<uses-sdk minSdkVersion="6" />
like image 152
John Jorsett Avatar answered Dec 21 '22 15:12

John Jorsett