I am working on the option menu to click on the menu item so I can fetch the html source as a string. I want to fetch the html source from the webview, but i dont know how to do this.
Here is the code:
webView.getSettings().setJavaScriptEnabled(true);
// For API level below 18 (This method was deprecated in API level 18)
webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
if (Build.VERSION.SDK_INT >= 19) {
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
else {
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
webView.loadUrl("file:///android_asset/richtexteditor/index.html");
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.action_send) {
}
}
Can you please show me an example how I can fetch the html source from the webview when I click on the option menu item?