Android detect webview URL change

I know I’m late to the game but I ran into this issue over and over … I finally found a sloution which is pretty straight forward. Just override WebViewClient.doUpdateVisitedHistory override fun doUpdateVisitedHistory(view: WebView?, url: String?, isReload: Boolean) { // your code here super.doUpdateVisitedHistory(view, url, isReload) } It works with all url changes even the … Read more

HTML file input in android webview (android 4.4, kitkat)

Update 2: There is a simpler plugin to use with phonegap/cordova https://github.com/MaginSoft/MFileChooser Update: Sample project with Cesidio DiBenedetto plugin https://github.com/jcesarmobile/FileBrowserAndroidTest I opened an issue on the android open source project and the answer was: Status: WorkingAsIntended unfortunately, openFileChooser is not a public API. We are working on a public API in future releases of Android. … Read more

Eclipse continue crashing

Check bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=404776 . I suggest you to upgrade to the newest Eclipse 4.3 (Kepler). Alternativelly you can try workaround suggested in comment #6: For a workaround add the following to the end of your eclipse.ini -Dorg.eclipse.swt.browser.DefaultType=mozilla

Android Webview POST

Two ways to load post response in webview: webview.loadData(): Like what you have posted in your solution. But “content loaded through this mechanism does not have the ability to load content from the network”. webview.postUrl(): Use this if post response needs to load content from the network. (NOTE: only accessible from api-level 5, which means … Read more

Android WebView JellyBean -> Should not happen: no rect-based-test nodes found

The issue occurs because in some scenarios WebView fails to notice that its visible rect has changed, so as far as webkit is concerned the page is still not visible. Thus all touches fall outside of the window, and get rejected. The cleanest fix is when you know the visibility of your WebView has changed … Read more

Caching in Android webview

Don’t use these: viewer.getSettings().setAppCacheMaxSize(1024*1024*8); viewer.getSettings().setAppCachePath(“/data/data/com.your.package.appname/cache”‌​); viewer.getSettings().setAppCacheEnabled(true); These have nothing to do with the default webview internal cache. Appcache is an entirely different feature mean to make you able to run the website w/o an internet connection. It does not work that great and probably you do not want to use it. With setting this: viewer.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT) … Read more

WebView “flashing” with white background if hardware acceleration is enabled (Android 3.0+)

I found the most effective fix for this, first mentioned here, was to set a transparent background color after the layout has been inflated: webView.setBackgroundColor(Color.argb(1, 0, 0, 0)); Yes, it’s a total hack, but it’s the only solution I’ve found to work well without disabling hardware acceleration. Note that this does not work through setting … Read more

How can I see Javascript errors in WebView in an Android app?

You can actually receive the console messages from a WebView, which would allow you to catch the errors that it throws. To do so: Enable JavaScript on your WebView Set a WebChromeClient Override onConsoleMessage Example: final WebView webView = (WebView) findViewById(R.id.webview_terms_conditions); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); webView.setWebChromeClient(new WebChromeClient() { @Override public boolean onConsoleMessage(ConsoleMessage consoleMessage) { … Read more

Android WebView inside ScrollView scrolls only scrollview

Here is the solution. Found online. I have subclassed WebView and i’m using the requestDisallowInterceptTouchEvent(true); method to allow my webview to handle the scroll event. TouchyWebView.java package com.mypackage.common.custom.android.widgets public class TouchyWebView extends WebView { public TouchyWebView(Context context) { super(context); } public TouchyWebView(Context context, AttributeSet attrs) { super(context, attrs); } public TouchyWebView(Context context, AttributeSet attrs, int … Read more