PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, November 7, 2022

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

 November 07, 2022     android, emulation, menu, optionmenu     No comments   

Issue

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.



Answered By - Ted Hopp
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing