how to display progress while loading a url to webview in android?

set a WebViewClient to your WebView, start your progress dialog on you onCreate() method an dismiss it when the page has finished loading in onPageFinished(WebView view, String url) import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.Window; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Toast; public … Read more

Android – local image in webview

Load Html file in Webview and put your image in asset folder and read that image file using Html. <html> <table> <tr> <td> <img src=”https://stackoverflow.com/questions/6127696/abc.gif” width=”50px” alt=”Hello”> </td> </tr> </table> </html> Now Load that Html file in Webview webview.loadUrl(“file:///android_asset/abc.html”);

Android: Disable text selection in a webview

This worked for me mWebView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { return true; } }); mWebView.setLongClickable(false); I have not tested, if you don’t want the vibration caused by the long click, you can try this: mWebView.setHapticFeedbackEnabled(false);

Android webview crash “Fatal signal 5 (SIGTRAP)”

Try to override the back navigation functionality and close the popup yourself. You don’t need to handle all the stack navigation logic, just have a state when you are showing this popup. Apply your own navigation logic(like manually closing the popup). void onBackPressed(){ if(isTheBuggyPopupIsOn){ closeTheBuggyPopup(); } else{ super.onBackPressed(); } }

How to use custom font with WebView

loadData didn’t work for me either, so I used file:///android_asset in the src path. It worked with loadDataWithBaseURL! For this example I changed the CSS to: @font-face { font-family: ‘feast’; src: url(‘fonts/feasfbrg.ttf’); } body {font-family: ‘feast’;} Then use the assets path as the base url: loadDataWithBaseURL(“file:///android_asset/”,myhtml,”text/html”,”utf-8″,null);

Make Android WebView not store cookies or passwords

You can use this to prevent cookies from being stored and clean cookies already stored: CookieSyncManager.createInstance(this); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookies(callback); cookieManager.setAcceptCookie(false); WebView webview = new WebView(this); WebSettings ws = webview.getSettings(); ws.setSaveFormData(false); ws.setSavePassword(false); // Not needed for API level 18 or greater (deprecated)