michkaravolos / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

Problem with exchanging data via events between python and webview #559

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What device(s) are you experiencing the problem on?
Motorola Milestone 2 (MotoA953 - like Droid 2 global)

What firmware version are you running on the device?
Version.62.4.24.A953.O2.en.DE

What steps will reproduce the problem?
1. copy the attached files to /mnt/sdcard/sl4a/scripts on the phone
2. start canvasWebview.py
3. enter some text into the "What text should be drawn?" textbox
4. tap the "Draw" button

What is the expected output? What do you see instead?
I would expect a Javascript alert that shows the entered text and a Toast that 
shows the entered text and the text in the canvas should change to the entered 
text.
Instead the webview only turns white.

What version of the product are you using? On what operating system?
latest sl4a_r5x on Froyo (Android 2.2.2)

Please provide any additional information below.
The text-to-speech stuff ("Say" button), which is using very similar code, 
works fine.
Others also seem to have problems with webview and event handling:
http://groups.google.com/group/android-scripting/browse_thread/thread/31a3df5ba0
ddb4cb?pli=1
http://stackoverflow.com/questions/7154669/send-events-from-python-to-javascript
-using-sl4a

Original issue reported on code.google.com by Neumae...@gmail.com on 26 Aug 2011 at 9:56

Attachments:

GoogleCodeExporter commented 9 years ago
I downloaded the sl4a source and debugged a little.
When the user clicks on the Draw button, the write() JavaScript function never 
gets called (no alert box).
I verified that the call() method in the JavaScriptWrapper of sl4a also isn't 
called.
So I changed the name of the JavaScript function to something different 
(drawText) and voilá - it works!
So the webview crashes when you call a function called write()!
I can easily avoid that, but you should probably fix it if you can ;-)

Original comment by Neumae...@gmail.com on 1 Sep 2011 at 8:00