Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load static HTML into Webview

This is becoming extremely frustrating at this point.. everything appears to be correct but I get "Webpage not available" in the webview area. The webpage at file:///android_assets/test.html might be temporarily down or ..... When I coded a quick html page with a string in the same area.. it worked??

my code:

import android.os.Bundle;
import android.webkit.WebView;
import android.app.Activity;

public class ProtoActivity extends Activity {
    /** Called when the activity is first created. */

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        WebView webView;


        webView = (WebView) findViewById(R.id.webView1);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.loadUrl("file:///android_assets/test.html");

   }
}
like image 522
DJPlayer Avatar asked Dec 17 '22 02:12

DJPlayer


1 Answers

Maybe

webView.loadUrl("file:///android_asset/test.html");

(not android_assetS)

like image 96
Vyacheslav Shylkin Avatar answered Dec 21 '22 10:12

Vyacheslav Shylkin