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


 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;





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.







Other Threads

1. Maximum Timeout for isReachable()

Hi everyone,

I'm using InetAddress.getByName(params[0]).isReachable(300000) to
determine if my NAS is alive.
By measuring the time before and after the above methode I found out
that the timeout has a maximum of about 3 min. 10 seconds, even if I
set the timeout to 600000 (about 10 minutes).

Am I doing something wrong? Or is there a better way to implement such



2. Widget does not update


I've developped a widget and some users report it's not updating and
put a one-star comment in the Market!

I'm using both the updatePeriodMillis in the Xml and a service (using
AlarmManager and registered events) to ensure Widget gets updated.
I also tests on 2 devices (one HTC and one APAD). On the APAD I never
receive the onUpdate() except the first!?

Within the service I store all widget information to be able to
recover in case process is killed (by app killer or android)
During widget update I check service is running and restart it if

Now I've read the process lifecycles and noted that Android may kill
my service or even my process if memory is low!

If both are killed, there is no chance the widget will ever get
updated again!
If service is killed then next update will be based on
updatePeriodMillis if ever, user will still complain!
If process is killed, no more updatePeriodMillis, but updates are

Is there a way to recover from these scenarios? How can I retrieve the
widget ids, managers and context if I manage to start a new process?

Why my service if killed is not restarted on the next Alarm or
registered events trigger???

I start the alarm with this:
                        Intent intent = new Intent(context,
                        pending_intent = PendingIntent.getBroadcast(ctx, 0, 
intent, 0);
                        schedule_manager =

I assumed that even if I end the process this alarm will instantiate a
new bmw_scheduler class and launch it???
But it doesn't seem to happen...

Any help will be much appreciated!


3. Converting Adobe Flash CS5 files to apk files?

4. Memory Usage for multiple ImageViews but same Image source

5. Ip packet in android............

6. I can't see my own posts here?

7. onSaveInstanceState problem while making oAuth request