views:

34

answers:

2

Hi!

I have an application that uses a WebView and a html-page with javascript functions. Randomly the JavaScript functions doesn't seem to be called. It works up to a random point (I have looked at this bug all day) can only be produced on hardware (HTC Legend) not on emulator.

Basicly I'm using callback to javaScript whenever the user presses a button, these callbacks tell the html to redraw using javaScript functions.

mHandler.post(new Runnable() { public void run() { mWebView.loadUrl("javascript:getDataLine()"); } });

The first line in this javaScript code is an alert that says that it has started, so that I can see that it's working.

Settings alerts or console.log's everywhere won't help as it seems the problem is in the webview or in Android itself. I need a way to see what's going on in the background. Maybe see if a previous call failed and stalled the thread or something.

A: 

Try getting rid of the mHandler.post() stuff. You should be able to call loadUrl() from a Button's onClick() without it.

CommonsWare
A: 

the Handler isn't the problem I tried without it. Using the handler also seperates WebView operation from my GUI-thread.

AndersWid