Home » Android » How to configure the Android Emulator to show onscreen buttons like the new Galaxy Nexus?

How to configure the Android Emulator to show onscreen buttons like the new Galaxy Nexus?

Posted by: admin February 23, 2018 Leave a comment

Questions:

I would like to convert/adapt my application to Android 4.0.
To do so I plan to use the ActionBar on devices that support it.
All Android version >= 3.0 do so. Furthermore devices that do not have a hardware menu button seem to show an “menu” button on the actionbar automatically.

When I test my application on the emulator using API level 13 this does work as expected…
… but somehow I’m not able to setup the emulator to behave the same way while emulating a phone on API level 14 (Android 4.0).
When I try to set “Hardware Back/Home keys” to false there are no buttons at all (not on the screen and not keypad provided by the emulator).

I have seen on some screenshots and videos from the “Galaxy Nexus” that it is showing an “menu” button on the ActionBar as well … like Honeycomb tablets do it, but I’m somehow not successful to do the same with the emulator which makes it a bit more complicated to understand how my UI will work on Andoid 4.0 phones.

EDIT:
Here is an image that is showing the On-Screen back and home buttons I would like to see in the emulator:

Answers:

It seems the issue was fixed with the latest update of the SDK (R16).
Just update your SDK and ADT to R16 and create a new emulator using the updated Android 4.0 system image.

Questions:
Answers:

When you create new emulator there is grid Hardware, and there you can add options Hardware home and back buttons and Hardware keyboard. So, create new emulator and look at your “Galaxy Nexus” 🙂

Unfortunately you can’t change this properties for existing emulator.

Questions:
Answers:

After upgrading to R16 I could only get the on-screen buttons to appear if I created an emulator using the WXGA720 resolution.

Here is my complete config.ini file:

hw.sdCard=yes
hw.mainKeys=no
hw.lcd.density=320
disk.cachePartition.size=256MB
hw.cpu.arch=arm
skin.name=WXGA720
sdcard.size=512M
abi.type=armeabi-v7a
image.sysdir.2=system-images\android-16\armeabi-v7a\
image.sysdir.1=add-ons\addon-google_apis-google-16\images\armeabi-v7a\
hw.gps=yes
skin.path=platforms\android-16\skins\WXGA720
hw.keyboard.lid=no
hw.cpu.model=cortex-a8
vm.heapSize=48
hw.ramSize=1024

Hopefully this helps someone.

Questions:
Answers:

The soft keys showed up for me when I set hw.mainKeys to no:

  1. Open $HOME/.android/avd/YOURS.avd/config.ini
  2. Set hw.mainKeys=no

(This was covered in a deleted answer; don’t know why it was deleted.)

Questions:
Answers:

If your application includes functionality that would respond to a menu button, the menu button will be added to the black bottom bar.

If you are having trouble seeing this in the emulator, you can do a bit of a workaround by setting it to a tablet resolution (I use 1280×800) and observing your menu button behavior there, as it should be the same as on the phone version.