PocketMagic

PocketMagic

Where Technology meets magic


Android
45 Posts
BlackBerry
4 Posts
Electronics
68 Posts
Hardware
120 Posts
High Voltage
49 Posts
iPhone
4 Posts
Linux
2 Posts
Nuclear
20 Posts
Optics
11 Posts
Photography
7 Posts
Photoshop
3 Posts
Research
19 Posts
Reviews
18 Posts
Robotics
8 Posts
Security
7 Posts
Software
73 Posts
Symbian
2 Posts
Tubes
18 Posts
Windows
3 Posts
Windows Mobile
11 Posts

Top Articles!       See PocketMagic on Facebook


uRADMonitor - Online Radiation monitoring station | 14933 Views | Rate 70.11
uRADMonitor - Online Radiation monitoring station
Bluetooth and iOS - Use Bluetooth in your iPhone apps | 18194 Views | Rate 58.69
Bluetooth and iOS - Use Bluetooth in your iPhone apps
NMEA GPS Library for AVR Microcontrollers | 4835 Views | Rate 56.22
NMEA GPS Library for AVR Microcontrollers
Programmatically Injecting Events on Android - Part 2 | 5012 Views | Rate 44.75
Programmatically Injecting Events on Android - Part 2
Building a robot – Part 2 | 4614 Views | Rate 44.37
Building a robot – Part 2
Simple Switched power Supplies | 16155 Views | Rate 41.85
Simple Switched power Supplies
Capacitor Discharge Microspot Welder / Cutter | 11356 Views | Rate 36.4
Capacitor Discharge Microspot Welder / Cutter
Atmega8 and Nokia 5110 LCD  | 1544 Views | Rate 35.09
Atmega8 and Nokia 5110 LCD

 
  

Android overriding Menu key to disable keyboard popup


By Radu Motisan Posted on March 19th, 2011 , 856 Views (Rate 1.08)



  




The standard functionality on Android devices makes the software keyboard popup every time the Menu is long pressed. This may be annoying or unwanted. To disable this default functionality, all one needs to do is to intercept the Menu key down event.

  1.  
  2. @Override
  3. public boolean onKeyDown(int keyCode, KeyEvent event) {
  4. if (!b.isChecked())
  5. return super.onKeyDown(keyCode, event);
  6.  
  7. if (keyCode == KeyEvent.KEYCODE_MENU) {
  8. return true;
  9.  
  10. }else return super.onKeyDown(keyCode, event);
  11. }
  12.  

If the checkbox is on, the MENU long press will be overridden and the keyboard won't open. A side effect is that also short MENU presses won't work anymore (like when trying to open a predefined application menu).

Source code: OverridingMenu






  

More on PocketMagic:

Tube: USN-5J29 | 362 Views | Rate 25.86
Tube: USN-5J29
Atmega8 and enc28J60 for ethernet support | 7292 Views | Rate 24.64
Atmega8 and enc28J60 for ethernet support
How to set the AVR Fusebits | 1716 Views | Rate 23.83
How to set the AVR Fusebits
ATMega128 and HD44780 LCD using 3 Wires with the 74HC164 | 2058 Views | Rate 22.87
ATMega128 and HD44780 LCD using 3 Wires with the 74HC164
Dual H-Bridge for controlling two motors | 1199 Views | Rate 21.41
Dual H-Bridge for controlling two motors
USBAsp -  AVR USB Programmer  | 8102 Views | Rate 21.04
USBAsp - AVR USB Programmer

Thank you for commenting. Your comment won't show until approved, which can take some time.

Please copy the string e12kUQ to the field below: