For PhoneGap Application, as the instruction said, I have replaced the setContentView() line with super.loadUrl("file:///android_asset/www/index.html"); and the next line is appView.addJavascriptInterface( new JavaScriptInterface(this), "Android");
My question is
- if I wanna use appView in my JSInterface, how can I find it, or pass it into JSInterface, or reference it from JSInterface.
- And is appView the only webview in PhoneGap?
First you should not take the approach of adding your own JS interface. It is better if you write a PhoneGap plugin:
http://docs.phonegap.com/en/2.0.0/guide_plugin-development_android_index.md.html#Developing%20a%20Plugin%20on%20Android
We’ve already suffered through all the pains of making sure the JS interfaces are setup correctly. From your plugin you can get access to appView by using:
Yes, appView is the only webview in PhoneGap.