我在主要活动中使用以下代码,它给出的函数 display() 没有定义
public class cordovaExample extends DroidGap {
Context mcontext;
private novel n;
private Server s;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new Thread(new Server(this)).start();
try {
Thread.sleep(500);
} catch (InterruptedException e) { }
new Thread(new Client()).start();
super.init();
n = new novel(this, appView);
s = new Server(this,appView);
appView.getSettings().setJavaScriptEnabled(true);
appView.addJavascriptInterface(n, "novel");
appView.addJavascriptInterface(s, "Server");
super.loadUrl("file:///android_asset/www/index.html");
super.loadUrl("javascript:display()");
}
}
在最后一行给出错误 display() 未定义
function display() {
alert("abc");
}
上面的代码显示了我在 html 文件中使用的显示功能
任何类型的帮助将不胜感激