androidmenuemulationoptionmenu

how to get option menu on android api level 12 emulator?


I am new to work with android tablet api level 12. I have created 7 inches avd with 1024*600 screen resolution. I have implemented sample application for get the option menus on my screen and back button. I am unable to see option button and back button on my emulator.

I have implemented for option menu code as follows:

  @Override
 public boolean onCreateOptionsMenu(Menu menu) {
     MenuInflater inflater = getMenuInflater();
     inflater.inflate(R.menu.menu, menu);

     return true;
 }


 @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
    case R.id.icon:     Toast.makeText(this, "You pressed the icon!", Toast.LENGTH_LONG).show();
                        break;
    case R.id.text:     Toast.makeText(this, "You pressed the text!", Toast.LENGTH_LONG).show();
                        break;
    case R.id.icontext: Toast.makeText(this, "You pressed the icon and text!", Toast.LENGTH_LONG).show();
                        break;
    }

    return true;
}

Solution

  • You can use keyboard shortcuts to simulate the hardware buttons. There's a table of the shortcuts here. The Back button is simulated by pressing escape, and the menu button is simulated by the Page-Up or F2 keys.