Android WebView edit

Open Local File Create dynamic content in Webview

Layout.xml

<WebView
android:id="@+id/WebViewToDisplay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:fadeScrollbars="false" />

Load data into WebViewToDisplay

WebView webViewDisplay;
StringBuffer LoadWEb1;

webViewDisplay = (WebView) findViewById(R.id.WebViewToDisplay);
LoadWEb1 = new StringBuffer();
LoadWEb1.append("<html><body><h1>My First Heading</h1><p>My first paragraph.</p>");
//Sample code to read parameters at run time
String strName = "Test Paragraph";
LoadWEb1.append("<br/><p>"+strName+"</p>");
String result = LoadWEb1.append("</body></html>").toString();
        WebSettings webSettings = webViewDisplay.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webViewDisplay.getSettings().setBuiltInZoomControls(true);
        if (android.os.Build.VERSION.SDK_INT >= 11){
            webViewDisplay.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            webViewDisplay.getSettings().setDisplayZoomControls(false);
        }

        webViewDisplay.loadDataWithBaseURL(null, result, "text/html", "utf-8",
                null);
        //To load local file directly from assets folder use below code
        //webViewDisplay.loadUrl("file:///android_asset/aboutapp.html");

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Table Of Contents
20 WebView
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close