android webview 加载本地html 实现 与 java 之间的相互响应
xml
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script type="text/javascript"> function show(jsondata){ var jsonobjs = eval(jsondata); var table = document.getElementById("personTable"); for(var y=0; y<jsonobjs.length; y++){ var tr = table.insertRow(table.rows.length); var td1 = tr.insertCell(0); var td2 = tr.insertCell(1); td2.align = "center"; var td3 = tr.insertCell(2); td3.align = "center"; td1.innerHTML = jsonobjs[y].name; td2.innerHTML = jsonobjs[y].amount; td3.innerHTML = "<a href='javascript:contact.call(\""+ jsonobjs[y].phone+ "\")'>"+ jsonobjs[y].phone+ "</a>"; } } </script> </head> <body onload="javascript:contact.showcontacts()"> <button id="button" onclick = "javascript:contact.toast('123')">haha</button> <table border="0" width="100%" id="personTable" cellspacing="0"> <tr> <td width="30%">姓名</td> <td width="30%" align="center">存款</td> <td align="center">电话</td> </tr> </table> </body></html>
代码:http://download.csdn.net/my