Menu

KeyboardSupportInApplications

Anonymous

Introduction

This page is intended for developers who want to support the additional keys offered by Hacker's Keyboard in their application, as mentioned in FrequentlyAskedQuestions. Doing so is equivalent to supporting an external physical keyboard connected via USB or Bluetooth, so if you make the suggested changes your application should work with both.

Enabling additional key support

Starting with Honeycomb (3.0), Android supports a full set of keycodes for key events: http://developer.android.com/reference/android/view/KeyEvent.html

Note that your application doesn't need to require Honeycomb to support these key events. Hacker's keyboard sends the corresponding numeric keycodes on all supported systems (>= 2.2), and you can manually handle these codes in your application while still building with an earlier SDK version.

See for example this patch for Android VNC Viewer's issue 238:

  public boolean onKeyDown(int keyCode, KeyEvent evt) {
    switch (keyCode) {
    //...
    // Previously supported keys
    case KeyEvent.KEYCODE_DEL:           // ...
    case KeyEvent.KEYCODE_ENTER:         // ...
    case KeyEvent.KEYCODE_DPAD_CENTER:   // ...

    // new keys available in the 2.2 SDK:
    case KeyEvent.KEYCODE_TAB:           // ...
    case KeyEvent.KEYCODE_ALT_LEFT:      // ...
    case KeyEvent.KEYCODE_ALT_RIGHT:     // ...

    // new keys added in the 3.0 SDK:
    case 92 /* KEYCODE_PAGE_UP */:       // ...
    case 93 /* KEYCODE_PAGE_DOWN */:     // ...
    case 111 /* KEYCODE_ESCAPE */:       // ...
    case 112 /* KEYCODE_FORWARD_DEL */:  // ...
    case 113 /* KEYCODE_CTRL_LEFT */:    // ...
    //[...]
    case 122 /* KEYCODE_MOVE_HOME */:    // ...
    case 123 /* KEYCODE_MOVE_END */:     // ...
    case 124 /* KEYCODE_INSERT */:       // ...
    case 131 /* KEYCODE_F1 */:           // ...
    //[...]
    case 142 /* KEYCODE_F12 */:          // ...

Related

Wiki: FrequentlyAskedQuestions

Discussion

  • Anonymous

    Anonymous - 2012-01-15

    Originally posted by: darshant...@gmail.com

    Case 143

     
  • Anonymous

    Anonymous - 2012-01-15

    Originally posted by: darshant...@gmail.com

    Case 143

     
  • Anonymous

    Anonymous - 2012-01-23

    Originally posted by: ramsingh...@gmail.com

    It's very fentastic

     
  • Anonymous

    Anonymous - 2012-01-23

    Originally posted by: ramsingh...@gmail.com

    It's very fentastic

     
  • Anonymous

    Anonymous - 2012-06-22

    Originally posted by: gregory....@gmail.com

    public void onKey(int primaryCode, int]()[ keyCodes) {

    if (primaryCode==112){

    getCurrentInputConnection().deleteSurroundingText(0, 1);

    }

    else

    This is a solution to make delete key working

     
  • Anonymous

    Anonymous - 2012-12-22

    Originally posted by: NorshidV...@gmail.com

    Gufyh

     
  • Anonymous

    Anonymous - 2013-10-04

    Originally posted by: Matri...@gmail.com

    <a rel="license" href="http://creativecommons.org/licenses/by/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/3.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.

     
  • Anonymous

    Anonymous - 2013-11-06

    Originally posted by: assalana...@gmail.com

    assalanass12@gmail.com

     
  • Anonymous

    Anonymous - 2013-12-05

    Originally posted by: sadiqpat...@gmail.com

    Yes

     
  • Anonymous

    Anonymous - 2013-12-16

    Originally posted by: the.don0...@gmail.com

    Gsjhvfdsfhkifcxsdfhjdhjkouytffghhjgvfssdghyrdfhjfg₣h0 §!HGFFHHGGHÆX ,

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.