javascript - calling HTML using webViewShow in sl4a -


trying out basic html scripts sl4a , python application can't seem call html... trying send data small form in html on python side

here's html

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>html form</title> <link rel="stylesheet" href="style.css"/>  </head>  <body> <div id="body"> <h1>my settings</h1> <script type="text/javascript"> var droid = new android(); function post_data(){ var values = [ ['airplane', document.getelementbyid('airplane_mode').value], ['wifi', document.getelementbyid('wifi_on').value], ['brightness', document.getelementbyid('brightness').value], ['volume', document.getelementbyid('volume').value], ]; var q = '?'; (i=0;i<values.length;i++){     var k = values[i][0];     var v = values[i][1];     if (q != '?'){     q = q + '&';     }     q = q + k + '=' + v;     }     droid.postevent('save', q);     } </script> <form onsubmit="post_data();"> <div class="container"> <div> <label for="airplane_mode">airplane mode</label> <input id="airplane_mode" name="radio" type="radio" /> </div> <div> <label for="wifi_on">wifi on</label> <input id="wifi_on" name="radio" type="radio" /> </div> <div> <label for="off">both off</label> <input id="off" name="radio" type="radio" /> </div> </div> <div class="container"> <div> <label for="brightness">brightness level</label> <input size="5" id="brightness" type="text" /> </div> <div> <label for="volume">media volume</label> <input size="5" id="volume" type="text" /> </div> </div> <div class="container buttons"> <div> <input size="5" id="save" name="save" type="submit" value="save settings" /> <input size="5" id="cancel" name="cancel" type="button" value="cancel" /> </div> </div> </form> </div>   </body> </html> 

here's python end uses values passed js in html alter phone options

import android import urlparse  droid = android.android() droid.webviewshow('file:///tablet/sl4a/scripts/html/options.html') while true:     result = droid.eventwaitfor('save').result     data = urlparse.parse_qs(result['data'][1:])     droid.toggleairplanemode('airplane' in data)     print 'airplane' in data     droid.togglewifistate('wifi' in data)     print 'wifi' in data     droid.setscreenbrightness('screen' in data , 255 or 0) 

thing once execute python code, not call webviewshow @ , closes stating response not parseable because it's value none, not tuple did go wrong?

update: tried different formats url none worked. webview not being called

update 2: okay... webview opening blank page forces me perform hard kill using task manager sl4a freezes there, if it's trying render html

update 3: had webviewshow refer non existent address , screen issue keeps on happening. ideas?

py4a latest , sl4a version r6. running on android 4.1.2

droid.webviewshow('file:///tablet/sl4a/scripts/html/options.html',none) 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -