I am trying to use WebView to show a local HTML file containing a table. However, when I use the WebView to check websites online it works perfectly, the problem is when i try to use the local HTML file.
This is the webView part of the code:
WebView myWebView = (WebView) v.findViewById(R.id.webview);
myWebView.loadUrl("file:///asset/table.html");
I have used an online host to test the HTML file with this and it worked perfectly:
myWebView.loadUrl("http://ahmad92billectric.host56.com//home.html");
the HTIML file is in app\src\main\asset, I tried calling it using the following ways:
myWebView.loadUrl("file:///andriod_asset/table.html");
myWebView.loadUrl("file:///app/src/main/assets/table.html");
myWebView.loadUrl("file:///android_assets/table.html"); //this one is assets with an s at the end
I looked up many questions here non of the answers worked for me:
Loading existing .html file with android WebView
What does file:///android_assets/www/index.html mean?
Android webview loadurl("file:///android_asset/index.html#home") failed
Android Studio Assets not loading Local HTML File
I have checked many other questions with no fruitful results. I am using android studio 0.8.14