Raghupathy
Raghupathy

Reputation: 873

Modify default emulator

Our company is developing an android tablet and we are creating an emulator for out tablet.The problem is we have additional buttons present in our tablet which is not present in the default android tablet emulator.

Can anyone point to any online resource or help me out on how to modify the default android emulator to add additional buttons and catch the events generated by them?

I have googled it but all search result point to creating a button for android app and not an hardware button for the emulator.

Upvotes: 2

Views: 775

Answers (2)

Chris Stratton
Chris Stratton

Reputation: 40367

Look under platforms/android-whatever/skins/ in your sdk installation

Pick one of the emulator skins that's closest to what you want to create. Make a copy under a new name.

Edit the hardware.ini and layout files, adding any necessary png's to the directory. It seems pretty trivial to figure out by example, for instance:

back {
                image button.png
                x 112
                y 142
}

Use the command line option to over-ride the skin when launching, or create an avd that points to the new skin.

Upvotes: 2

colithium
colithium

Reputation: 10327

Perhaps you can use a custom key binding file? Run emulator -help-keyset-file to get:

C:\android-sdk-windows\tools>emulator -help-keyset-file

C:\android-sdk-windows\tools>
  on startup, the emulator looks for 'keyset' file that contains the
  configuration of key-bindings to use. the default location on this
  system is:

    C:\Users\Mitch\.android\default.keyset

  if the file doesn't exist, the emulator writes one containing factory
  defaults. you are then free to modify it to suit specific needs.

  this file shall contain a list of text lines in the following format:

    <command> [<modifiers>]<key>

  where <command> is an emulator-specific command name, i.e. one of:

    BUTTON_HOME         BUTTON_VOLUME_DOWN  BUTTON_DPAD_CENTER
    BUTTON_MENU         BUTTON_CAMERA       BUTTON_DPAD_LEFT
    BUTTON_STAR         CHANGE_LAYOUT_PREV  BUTTON_DPAD_RIGHT
    BUTTON_BACK         CHANGE_LAYOUT_NEXT  BUTTON_DPAD_UP
    BUTTON_CALL         TOGGLE_NETWORK      BUTTON_DPAD_DOWN
    BUTTON_HANGUP       TOGGLE_TRACING      ONION_ALPHA_UP
    BUTTON_POWER        TOGGLE_FULLSCREEN   ONION_ALPHA_DOWN
    BUTTON_SEARCH       TOGGLE_TRACKBALL
    BUTTON_VOLUME_UP    SHOW_TRACKBALL

  <modifers> is an optional list of <modifier> elements (without separators)
  which can be one of:

    Ctrl-     Left Control Key
    Shift-    Left Shift Key
    Alt-      Left Alt key
    RCtrl-    Right Control Key
    RShift-   Right Shift Key
    RAlt-     Right Alt key (a.k.a AltGr)

  finally <key> is a QWERTY-specific keyboard symbol which can be one of:

    BACKSPACE        8                O                KEYPAD_0
    TAB              9                P                UP
    CLEAR            COLON            Q                DOWN
    ENTER            SEMICOLON        R                RIGHT
    PAUSE            LESS             S                LEFT
    ESCAPE           EQUAL            T                INSERT
    SPACE            GREATER          U                HOME
    EXCLAM           QUESTION         V                END
    DOUBLEQUOTE      AT               W                PAGEUP
    HASH             LEFTBRACKET      X                PAGEDOWN
    DOLLAR           BACKSLASH        Y                F1
    AMPERSAND        RIGHTBRACKET     Z                F2
    QUOTE            CARET            DELETE           F3
    LPAREN           UNDERSCORE       KEYPAD_PLUS      F4
    RPAREN           BACKQUOTE        KEYPAD_MINUS     F5
    ASTERISK         A                KEYPAD_MULTIPLY  F6
    PLUS             B                KEYPAD_DIVIDE    F7
    COMMA            C                KEYPAD_ENTER     F8
    MINUS            D                KEYPAD_PERIOD    F9
    PERIOD           E                KEYPAD_EQUALS    F10
    SLASH            F                KEYPAD_1         F11
    0                G                KEYPAD_2         F12
    1                H                KEYPAD_3         F13
    2                I                KEYPAD_4         F14
    3                J                KEYPAD_5         F15
    4                K                KEYPAD_6         SCROLLOCK
    5                L                KEYPAD_7         SYSREQ
    6                M                KEYPAD_8         PRINT
    7                N                KEYPAD_9         BREAK

  case is not significant, and a single command can be associated to up
  to 3 different keys. to bind a command to multiple keys, use commas to
  separate them. here are some examples:

    TOGGLE_NETWORK      F8                # toggle the network on/off
    CHANGE_LAYOUT_PREV  Keypad_7,Ctrl-J   # switch to a previous skin layout

Upvotes: 1

Related Questions