PhoneGap的:如何获得appView的ID,并通过它周围? [英] PhoneGap: How do I get appView's id and pass it around?
问题描述
有关PhoneGap的应用程序,为指导说,我已经取代了的setContentView()
与 super.loadUrl(文件行:/// android_asset / WWW / index.html的);
键,下一行是 appView.addJavascriptInterface(新JavaScriptInterface(本),机器人);
我的问题是
- 如果我想用appView在我JSInterface,我怎么能找到它,或者把它传递到JSInterface,或者从JSInterface引用它。
- ,是PhoneGap的appView唯一的WebView?
首先,你不应该添加自己的JS接口的方法。这是更好,如果你写一个PhoneGap的插件:
<一个href="http://docs.phonegap.com/en/2.0.0/guide_plugin-development_android_index.md.html#Developing%20a%20Plugin%20on%20Android" rel="nofollow">http://docs.phonegap.com/en/2.0.0/guide_plugin-development_android_index.md.html#Developing%20a%20Plugin%20on%20Android
我们已经通过确保所有的痛苦遭遇JS接口正确的设置。从你的插件,你可以访问appView使用:
this.webView
是的,appView是PhoneGap的唯一的WebView。
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:
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:
this.webView
Yes, appView is the only webview in PhoneGap.
这篇关于PhoneGap的:如何获得appView的ID,并通过它周围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!