Javascript, WebView, and arrow keys.

by Ken Perry » Fri, 10 Sep 2010 00:22:12 GMT


Sponsored Links
 The following question has to do with Froyo 2.2 sdk 8 running on an
emulator.

 

 I am injecting Javascript  into a web page and in the WebView activity I
get 19, 20, 21, and 22 for key codes for arrow keys.  At the Javascript
level all four arrow key values in a keydown handler come in as zero.  The
following is the java script code I am using to set the handler and to get
the keyValue.

 

window.addEventListener('keydown', keyDownHandler, true); 

 

function keyDownHandler(evt){

var keyCode=evt.keyCode;

myLog(keyCode);

}

 

 

I will note that keys like enter come in correct for example I get 13 for
enter.  I also will note that if I press shift and then an arrow key I get
16 for all 4 arrow keys instead of 0.  myLog function takes a String but the
following works 

 

If (keyCode==0){

myLog("arrow key");

}

 

So the value is coming in as zero is there some way I can fix this.  If
someone has time I have a pretty simple example of this problem I could
probably zip up as an eclipse project.

 

Thanks,

 

Ken

  

--



Other Threads

1. wifi RA certificate issue

hi all,
Have you notice that user is not able to import WIFI RA certificate to
android. i'm using HTC Hero and i was really surprised when i failed
to add new certificate to my wifi connection.  it is possible even on
symbian so... you can edit advanced settings and then select add new
certificate, but than nothing happens like there would be only todo
comment block in code... I hope somebody will fix it because i don't
want to root my phone in order to have this functionality available.

--~--~---------~--~----~------------~-------~--~----~

2. How to run GPS based application (WikiTude) in Android SDK Emulator?

Hi All,

                Currently I am writing an Android application which uses 
WikiTude
API. I installed the WikiTude browser application in the Android SDK
emulator from Android Market (To get Android Market in emulator I
followed this link 
http://forum.xda-developers.com/archive/index.php/t-529170.html).

                When I run the WikiTude browser application in emulator it asks 
me
to set location settings. I enabled nable GPS satellitesoption &
run the application, again it make an alert for location settings. I
am not able to run this application. Please help me.

                Can anyone tell me is it possible to run GPS based application 
in
Android Emulator? Or not?

                          If it is, Is there any work around to run
GPS based application in emulator?

                       Any help will be greatly appreciated
                       Thanks in Advanceā‚¬.
                        Raghavendra K

--~--~---------~--~----~------------~-------~--~----~

3. Toronto Android Users Group

4. Issue with adapter redrawing when GridView Item

5. Computational cost of calling getReadableDatabase or getWriteableDatabase?

6. Peer-to-peer phone application?

7. ACTION_NEW_OUTGOING_CALL, abort