How to retrieve HTML content from WebView (as a string) [duplicate]
webView.evaluateJavascript(“(function(){return window.document.body.outerHTML})();”, new ValueCallback<String>() { @Override public void onReceiveValue(String html) { } });
webView.evaluateJavascript(“(function(){return window.document.body.outerHTML})();”, new ValueCallback<String>() { @Override public void onReceiveValue(String html) { } });
I have adapted the three solutions presented here (and modified one where it failed) to produce a single, simple setProxy method that works for all versions of Android. I’ve tested it from 10 to 18, and it works for all tested environments. UPDATED 2014-04-04 I finally worked in the solution from a comment below, courtesy … Read more
I finally found it:- WebSettings webSettings = webView.getSettings(); either setTextSize or webSettings.setTextSize(WebSettings.TextSize.SMALLEST); This one works too:- webSettings.setDefaultFontSize(10);
Use web.loadDataWithBaseURL instead of web.loadData (And don’t forget to escape strings where it’s needed) You need to add internet permission to download images and view them in your manifest file. This example works for me: public class SimpleMusicStream extends Activity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); WebView wv = (WebView) findViewById(R.id.WebView01); final … Read more
By default webview has some margin/padding in body. If you want to remove that padding/margin then override body tag and add margin like: <body style=”margin: 0; padding: 0″>
If you don’t have one you can try taking it like this String ua=new WebView(this).getSettings().getUserAgentString(); Edit- The doc for getUserAgentString() says Return the WebView’s user-agent string. So i don’t think you can get it unless you declare one. Some one correct me if i am wrong
I’m just following along the thread from this closed issue and it seems to me there are a couple of solutions that may work for you. First is from this comment by Anthony Dunk : Adding the class “needsclick” to the select fixed this issue for me on Android. Second that I found is this … Read more
It’s not a warning nor an error, just a debug message shown every time drawContentComposition is called. I imagine it shows that the value of hasComposition is false. You can’t do anything to avoid it so it shouldn’t bother you… well, obviously, in my opinion.
I realize this is an old question, but there is not an accepted answer, and none of the provided answers have many votes. I have achieved what you are trying to accomplish by creating a custom action mode callback. This allows the creation of a custom contextual action bar (CAB) when (in the case of … Read more
I went through the same trouble and actually what solved it was changing the context in the constructor to context.getApplicationContext(). After that it’s building and rendering with no problems on Android 5.