Document directory
- In Android:
- How to Write in HTML
In Android:
Public voidOncreate (bundle savedinstancestate ){
Super. Oncreate (savedinstancestate );
Setcontentview (R. layout.Main);
FinalWebview web1 = (webview) findviewbyid (R. Id.Web1);
FinalButtonMybutton= (Button) findviewbyid (R. Id.Mybutton);
HandlerH=NewHandler (); // declare a parameter for passing values
Web1.getsettings (). setjavascriptenabled (True); // Determine whether this webview can use JS
Web1.addjavascriptinterface (NewA (), "to2"); // Add the Class Object to the Global Object window of Js.
Web1.loadurl ("file: // android_asset/test.html"); // This is the HTML address for loading the project and put it in the assets folder.
Webviewclient WebClient =NewWebviewclient (){
@ Override
Public voidOnpagefinished (webview view, string URL ){
//TodoAuto-generated method stub
Super. Onpagefinished (view, URL );
}
};
Web1.setwebviewclient (WebClient );
}
ClassA {
Public voidA (){
Here, perform the corresponding logical operation.
}
How to Write in HTML
<Title> untitled document </title>
<SCRIPT type = "text/JavaScript">
Function F2 (){
Return window. to2.a ();
}
</SCRIPT>
</Head>
<Body>
<Table align = "center" width = "724px" Height = "600px">
<Tr align = "center">
<TD align = "center">
<Input name = "Submit" type = "Submit" value = "jump" onclick = "Return F2 ()"/>
</TD>
</Tr>
</Table>
</Body>
</Html>
Note: QQ technology exchange group: add one if you are interested in 108614806.