DJPlayer
DJPlayer

Reputation: 3294

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");

   }
}

Upvotes: 4

Views: 6310

Answers (1)

Vyacheslav Shylkin
Vyacheslav Shylkin

Reputation: 9801

Maybe

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

(not android_assetS)

Upvotes: 12

Related Questions