I am currently trying to make an app that would allow you to log into your account and view whatever data needs to be displayed.
I am not using webview but instead,
I am not sure what you are trying to do by logging the content of the WebPage there. What you need to do first is check if the "browser" has Javascript enabled but in your case this is moot because you are using your own WebView. It would still be wise to just check if JS is enabled.
The next step obviously involves using JS since I asked you to check if it is enabled. Here is the code but note I did nor test this but it is a step in the right direction:
public void loginUser(View view) {
InputMethodManager inputMan = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(layout.getWindowToken(), 0);
webView.loadUrl("https://yourwebsite.net");
webView.setVisibility(View.INVISIBLE);
webView.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
webView.loadUrl("javascript: {" + "document.getElementById('login_account').value = '" + "USERNAME" + "';" + "document.getElementById('login_password').value = '" + "PASSWORD" + "';" + "document.getElementById('submit').click();" + "};");
}
public void onPageFinished2(WebView view, String url) {
webView.loadUrl(url);
}
});
webView.clearCache(true);
webView.clearHistory();
WebView webView2 = (WebView) this.findViewById(R.id.web_view);
String url = "https://yourwebsite.net";
webView2.loadUrl(url);
}
Some points to note: change the values login_account and login_password to something that a person cannot easily guess for security.