I am using the following code in the main activity , its giving the function display() is not defined
public class cordovaExample extends DroidGap {
Cont
It's a bad idea to make Cordova load JavaScript on page load. This should be handled by your local JavaScript. Try to call your display() function like this in the HTML page itself:
If you need to call a JavaScript from within Cordova at any later point, it is possible to do so this way:
sendJavascript("display();");
To access this method from other classes, you will need to access your main activity. The easy-but-perhaps-unsafe method is to create a static variable in your main Activity that will hold the activity itself. Example:
public class MyActivity extends DroidGap {
public static MyActivity activity;
public void onCreate(Bundle savedInstanceState) {
activity = this;
}
}
Then, from anywhere in your classes, do:
MyActivity.activity.sendJavascript('display();');