High-Priced Help
"customHelp");
browser.loadUrl("file:///android_asset/help.html");
Button cast=(Button)findViewById(R.id.helpcast);
cast.setOnClickListener(onCast);
}
In particular, we need to enable Javascript in the WebView and inject our
CustomHelp object (under the name customHelp) before we load our help Web
page.
Step #4: Leverage the Java Object from Javascript
With all that done, we can take advantage of the customHelp object in our
Web page.
Somewhere on your page, add a
or with an id of userName, such
as:
<p>Your Twitter account name is:
<span id="userName"><i>unknown</i></span>!</p>
Then, add a global Javascript function that will replace the default contents
of the userName element with the value obtained from customHelp, such as:
<script language="javascript">
function updateUserName() {
document
.getElementById("userName")
.innerHTML=customHelp.getUserName();
}
</script>
Finally, add an onLoad attribute to your
element to trigger calling theglobal Javascript function, such as:
<body onLoad="updateUserName()">