phonegap:调用js

1.phoengap中调用js:

java代码中:

 

 

this.appView = (CordovaWebView) findViewById(R.id.tutorialView);
WebSettings webSetting = appView.getSettings();
		webSetting.setJavaScriptEnabled(true);
		webSetting.setCacheMode(WebSettings.LOAD_NO_CACHE);

		appView.addJavascriptInterface(new Object() {
			public void closeActivity() {
				mHandler.post(new Runnable() {
					public void run() {
						//appView.loadUrl("javascript:wave()");
						PhonegapFrame.this.finish();
					}
				});
			}
		}, "javaMethod");

 对应的html中:

 

function closeWindow() { 
		window.javaMethod.closeActivity();
	}

你可能感兴趣的:(PhoneGap)