1, now can only be used in the HTML button triggers the aaa by value in the Activity to HTML, hope to be able to open the page automatically when the incoming
2, jump when the Activity to HTML input value back to the Activity of printing in
Protected void onCreate (Bundle savedInstanceState) {
Super. OnCreate (savedInstanceState);
The setContentView (R.l ayout. Activity_h5);
MWebView=(WebView) the findViewById (R.i d.w ebview);
file:///android_asset/index.html mWebView. LoadUrl (" ");
WebSettings WebSettings=mWebView. GetSettings ();
WebSettings. SetJavaScriptEnabled (true);
MWebView. AddJavascriptInterface (new JsInteration (), "android");
Public static class JsInteration {
Int aaa=9999;
@ JavascriptInterface
Public int back () {
Return aaa.
}
}
@ JavascriptInterface
Public void toActivity (String activityName) {
If (TextUtils. Equals (activityName, "a")) {
StartActivity (new Intent (this, Activity_1. Class));
} else {
StartActivity (new Intent (this, Activity_h5. Class));
}
}
==========HTML code===========
The function gotoActivity (activity) {
NativeMethod. ToActivity (activity);
}
The function call_Activity () {
Var result=window. Android. The back ();
Document. The getElementById (" p_val "). The innerHTML=the result;
}
</script>
Name: & lt; Input type="text" name="fname"/& gt;