Android Web-View : Inject local Javascript file to Remote Webpage

There is a way to ‘force’ the injection of your local Javascript files from local assets (e.g., assets/js/script.js), and to circumvent the ‘Not allowed to load local resource : file:///android_assets/js/script.js …’ issue. It is similar to what described in another thread (Android webview, loading javascript file in assets folder), with additional BASE64 encoding/decoding for representing … Read more

Enhance webView performance (should be the same performance as native Web Browser)

I finally got the reason of android webview bad performance issue. Notice the image below… It used 12 seconds from OnPageStarted to OnPageFinished. Because it should load CSS,javascript and … AJAX… I notice that JQuery and JQueryMobile need load all DOM struct in Html.So if I lazy load the javascript after OnPageFinished,it should show page … Read more

Load local html in WebView?

You can only do something like that. This solution load HTML from a String variable: String html = “<html><body>Hello, World!</body></html>”; String mime = “text/html”; String encoding = “utf-8”; WebView myWebView = (WebView)this.findViewById(R.id.myWebView); myWebView.getSettings().setJavaScriptEnabled(true); myWebView.loadDataWithBaseURL(null, html, mime, encoding, null); EDIT: try to set the first parameter (the baseURL) of loadDataWithBaseURL() for your needs

Android WebView UTF-8 not showing

Use: mWebView.loadDataWithBaseURL(null, “將賦予他們的傳教工作標示為”, “text/html”, “utf-8”, null); or using WebSettings with setDefaultTextEncoding: WebSettings settings = mWebView.getSettings(); settings.setDefaultTextEncodingName(“utf-8″); For recent versions of Android, API 16 to 22 it was tested and work properly using loadData() method, requires the mimeType to include: “charset=utf-8”. WebView mWebView = (WebView) findViewById(R.id.myWebView); WebSettings settings = mWebView.getSettings(); settings.setDefaultTextEncodingName(“utf-8”); mWebView.loadData(myCharacters, “text/html; charset=utf-8”,null); or mWebView.loadData(myCharacters, … 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