java - Getting values of textarea of html in Android -


i have html page loaded on webview. there 4 textareas present in html page fill after page loaded on webview , when filled them, want values of textareas on click of next button in android (next button in android not in html page) but, cant values of textareas in android. please me. in advance.

here html page loaded on webview.

enter image description here

in html page, linked "ok" button:

function ok() {     var t1 = document.getelementbyid("textarea1").value;     var t2 = document.getelementbyid("textarea2").value;     var t3 = document.getelementbyid("textarea3").value;     var t4 = document.getelementbyid("textarea4").value;      var result = json.parse(bridge.doit(t1,t2,t3,t4));     } } 

in application's webview:

  class mybridge {         public mybridge(context context) {             // ...         }         @javascriptinterface         public string doit(string t1,                 string t2,                 string t3,                 string t4) {         // whatever want here values         }     } 

and in webview's constructor:

    this.addjavascriptinterface(new mybridge(pcontext), "bridge"); 

this should work (using myself). if don't want use ok button, you'll have change code bit fit needs, maybe call function on "onkeypress" of text fields.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -