4

I am loading the url on the WebView which is a login page. Once user enters username, password and hits the Login button, i want to fetch the username. I looked at the solutions in SO, but those are showing to edit the html but it is not possible in my case. In iOS i am getting username by the following piece of code

NSString* usernameValue = [ webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('username').value"];

Below is my android code

WebView view = (WebView) this.findViewById(R.id.webView);
    view.loadUrl("http://testing/irednew/src/index.php/welcome");
    view.getSettings().setJavaScriptEnabled(true);
    view.getSettings().setDomStorageEnabled(true);

How to get the username in Android WebView?

Sudheer Kumar Palchuri
  • 2,919
  • 1
  • 28
  • 38
  • http://stackoverflow.com/a/9581016/4070044 - take a look – shine_joseph Aug 01 '15 at 11:16
  • i followed the below post and fixed my issue. [http://stackoverflow.com/questions/8200945/how-to-get-html-content-from-a-webview][1] [1]: http://stackoverflow.com/questions/8200945/how-to-get-html-content-from-a-webview – Sudheer Kumar Palchuri Aug 05 '15 at 06:28

0 Answers0