Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid OnCreateOptionsMenu NOT displaying on Galaxy Tab 10.1
    primarykey
    data
    text
    <p>I try to add an option menu to my app.</p> <pre><code> public static final int MENU_AIDE = Menu.FIRST+1; public static final int MENU_CONTACT = Menu.FIRST+2; public static final int MENU_APROPOS = Menu.FIRST+3; public static final int MENU_QUITTER = Menu.FIRST+4; public boolean onCreateOptionsMenu(Menu menu) { menu.add(Menu.NONE, MENU_AIDE, Menu.NONE, "Aide").setIcon(R.drawable.menu_aide); menu.add(Menu.NONE, MENU_CONTACT, Menu.NONE, "Nous Contacter").setIcon(R.drawable.menu_contact); menu.add(Menu.NONE, MENU_APROPOS, Menu.NONE, "A propos").setIcon(R.drawable.menu_apropos); menu.add(Menu.NONE, MENU_QUITTER, Menu.NONE, "Quitter").setIcon(R.drawable.menu_quitter); return(super.onCreateOptionsMenu(menu)); } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_AIDE: Toast.makeText(this,"aide",Toast.LENGTH_SHORT).show(); return (true); //add(); return(true); case MENU_CONTACT: Toast.makeText(this,"contact",Toast.LENGTH_SHORT).show(); return (true); case MENU_APROPOS: Toast.makeText(this,"à propos",Toast.LENGTH_SHORT).show(); return (true); case MENU_QUITTER: Toast.makeText(this,"quitter",Toast.LENGTH_SHORT).show(); return (true); } return(super.onOptionsItemSelected(item)); } </code></pre> <p>BUT the menu does not display on my tablet, whereas it is ok on my emulator when clicking the "menu" buton. The onCreateOptionsMenu function is not even launched(??) on the tab!!</p> <p>I just do not know why not on the tablet since both run under 4.1.</p> <p>I figured out that removing the line</p> <pre><code>&lt;uses-sdk android:minSdkVersion="11" android:targetSdkVersion="16" /&gt; </code></pre> <p>makes the menu displays also on my tab..........</p> <p>But why? And how solve it, I mean how keep the min &amp; target SDK flag AND make the option menu buton visible on my tablet?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload