java - Send javascript to phonegap web view -
i working on android app phonegap, want send piece of javascript native java code "alert('23')" web view, how?
details:
phonegap: 3.0.0
platform: android
i use sendjavascript
function purpose nothing happened , not working me.
my code:
public class helloworld extends droidgap { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // set <content src="index.html" /> in config.xml super.loadurl(config.getstarturl()); //super.loadurl("file:///android_asset/www/index.html") intent intent = getintent(); string action = intent.getaction(); string type = intent.gettype(); if (intent.action_send.equals(action) && type != null) { this.handlesendtext(intent); } } public void handlesendtext(intent intent) { string sharedtext = intent.getstringextra(intent.extra_text); if (sharedtext != null) { string js = string.format("callss('%s');", "hadi"); // code send javascript this.sendjavascript(js); } } }
somewhere read use webview.sendjavascript instead, webview not accessible. if information must presented describe them.
just use:
super.loadurl('javascript:myfunction()');
Comments
Post a Comment