Reputation: 131
I have created a javascript
script and would like to run it in a webview
in my android
app. How do I go about doing this so when the user clicks on the money button
the javascript
runs.
<script type="text/javascript" src="https://static.leaddyno.com/js"></script>
<script>
LeadDyno.key = "hg5kjh5j4h6jhjhjkk7hjhjhjkh56vhjfgcg4gjd";
LeadDyno.recordVisit();
LeadDyno.autoWatch();
</script>
btnMoney.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Run Javascript
myWebView.loadUrl("javascript:LeadDyno.recordVisit()");
myWebview2.loadUrl("javascript.LeadDyno.autoWatch()");
}
});
Upvotes: 0
Views: 61
Reputation: 2998
load it by webview like:
webview.load("file:///android_asset/html.html");
Do not forget to add android.permission.INTERNET in your manifest file
Upvotes: 1