You can get the content of the WebView
using this function:
yourWebView.evaluateJavascript(
"(function() { return ('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>'); })();",
new ValueCallback<String>() {
@Override
public void onReceiveValue(String html) {
Log.d("HTML", html);
// Here you work with the content of the page which is stored in the 'html' variable
}
});
Since you are able to read the content of the page, you can either hide the data you want to read in the website in a hidden field (e.g. <input type="hidden" id="emailAddress" name="emailAddress" value="someone@example.org">
).
Or you can create a own Activity
where the use can insert his email address, and then you can post the inserted email address on your website using the WebView.postUrl(String url, byte[] postData)
function (e.g. webView.postUrl("https://yourWebsite.com/index.php", "emailAddress=someone@example.org".getBytes());
).
Source:
https://developer.android.com/reference/android/webkit/WebView.html
how to get html content from a webview?
How to post data for WebView android