Upload static HTML to Webview

This is currently becoming very unpleasant. Everything seems to be correct, but I get a "webpage unavailable" in the webview area. The webpage in the file: ///android_assets/test.html may be temporarily disabled or ..... When I encoded a fast html page with a string in the same area .. did it work?

my code is:

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"); } } 
+4
source share
1 answer

maybe

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

(not android_assetS)

+12
source

Source: https://habr.com/ru/post/1401181/


All Articles