I have two local html pages.  At start, one page is loaded with a few input
text fields and buttons. One button triggers the second pages to be loaded
with a few input fieds and buttons.  Now, my JavascriptInterface on the main
activity tris to populate the second page's input test by calling the
pages's javascript function, just as what I did on the first page.  However,
the function on the second page seems not visiable to the
javascriptInterface on main activity.  Error: refereenced var xxx not
defined.

Page1 has
function display1(data){
  document.getElementById('d1').value = data[1];
}
<input id=d1" type="text"/>

Page2 has
 function display2(data){
  document.getElementById('d2').value = data[2];
}
<input id=d2" type="text"/>

JavascriptInterface(){
   ......
*

public* *void* loadSecondPage(){

webView.loadUrl("file:///android_asset/second.html");

Collection<String> c = *new* ArrayList<String>();

----------

JSONArray ja = *new* JSONArray(c);

String url = "javascript:display2(" + ja.toString() +")";

webView.loadUrl(url);

}
}

Error: the second page is loaded but the display2 is not define

This is just a test app.  I have a few pages and I need to make sure I know
how to navigate these pages and with one main android activity and one
javascriptinterface.

Otherwise, I guess I have to have one activity and one javascriptinterface
for each html page.

Thank you

QD

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to