4 Replies - 3740 Views - Last Post: 27 December 2011 - 06:59 AM

#1 harmy01   User is offline

  • D.I.C Head
  • member icon

Reputation: 15
  • View blog
  • Posts: 179
  • Joined: 15-June 10

Using android's soft keyboard virtual keycode on computer

Posted 07 December 2011 - 03:00 AM

I'am working on a application which allows your computer to type using android keyboard via Bluetooth. My application sends objects to the server(programmed in java) on PC via Bluetooth, the object sent contains the key code to be pressed. But i'm having problem the android keyboard virtual Keycodes are mapped to different characters on the PC. For example, if i press "h" on android this gets translated into "Home" on PC. The Keycode are obtained by overriding onkeyup of View.

Question: Is there a way to translate android Keycode into computer, so it does not type different characters. Note: on android i'm using qwerty keyboard type as well as on my computer.

Is This A Good Question/Topic? 0
  • +

Replies To: Using android's soft keyboard virtual keycode on computer

#2 H3R3T1C   User is offline

  • Android Expert
  • member icon

Reputation: 278
  • View blog
  • Posts: 757
  • Joined: 30-March 07

Re: Using android's soft keyboard virtual keycode on computer

Posted 07 December 2011 - 11:26 AM

Why not just send over the char for the key you pressed instead of the key code?
Was This Post Helpful? 0
  • +
  • -

#3 harmy01   User is offline

  • D.I.C Head
  • member icon

Reputation: 15
  • View blog
  • Posts: 179
  • Joined: 15-June 10

Re: Using android's soft keyboard virtual keycode on computer

Posted 07 December 2011 - 03:06 PM

Because. Im using the robot to type, which uses keycodes. But if u convert char to int it should give you the keycode? im gonna try this.

EDIT: just tried it, does not work the robot doesn't recognize some of the characters sent to it.

This post has been edited by harmy01: 07 December 2011 - 03:36 PM

Was This Post Helpful? 0
  • +
  • -

#4 kiran.vmath   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 26-December 11

Re: Using android's soft keyboard virtual keycode on computer

Posted 26 December 2011 - 07:03 AM

Hi harmy01,

I am also facing same kind of problem. So did u find any solution?
Was This Post Helpful? 0
  • +
  • -

#5 farrell2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 874
  • View blog
  • Posts: 2,706
  • Joined: 29-July 11

Re: Using android's soft keyboard virtual keycode on computer

Posted 27 December 2011 - 06:59 AM

View Postharmy01, on 07 December 2011 - 10:00 AM, said:

But i'm having problem the android keyboard virtual Keycodes are mapped to different characters on the PC. For example, if i press "h" on android this gets translated into "Home" on PC. The Keycode are obtained by overriding onkeyup of View.


Why not just examine the incoming Key code and map it to the proper on one the PC? You capture the android keycode, examine it, modify it if need be, then send it to the pc.

You know that the keycode value for h on android is 36. From what you tell me, I can assume that vk_home on the pc has a value of 36, right?

A switch statement or if examining the keys you know give you problems could solve this.

before you send to the pc:

if keyCode == 36
keyCode = value of PC Java KeyEvent.vk_h

make the correction for the ones you know are different, then sent them to your robot.
understand?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1