Issue
I have created a WebView activity like the following. I'm not able to make it working.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
JAsocket socket1=new JAsocket();
webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.addJavascriptInterface(socket1, "socket");
webView.loadUrl("file:///android_asset/index.html");
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
}
My question is if I manipulate some member variables of "socket1" by calling its function in javascript via "socket",can I see those changes in this activity using socket1 as I pass the same object to the javascript.
Thanks.
Solution
The answer to your question is yes, sure. Have a look at a few examples.
http://android-developers.blogspot.in/2008/09/using-webviews.html
http://techdroid.kbeanie.com/2010/10/android-webview-javascript-and-css.html
You are half way through by the way.
Answered By - Kumar Bibek
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.