I want to make my website in html file to android apk. I was make an app with webview and the url is in file directory, and i found error file not found. But i don't know to make offline. I am use aide.
Asked
Active
Viewed 412 times
-4
-
send the screenshot of your error – Vishal Sharma Sep 07 '18 at 13:53
-
//go on this link https://www.javatpoint.com/android-webview-example – Vishal Sharma Sep 07 '18 at 13:55
-
better to wrap it in cordova – Faisal Naseer Sep 07 '18 at 13:58
1 Answers
0
// use this on main activity.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView mywebview = (WebView) findViewById(R.id.webView);
// mywebview.loadUrl("https://www.javatpoint.com/");
/*String data = "<html><body><h1>Hello, Javatpoint!</h1></body></html>";
mywebview.loadData(data, "text/html", "UTF-8"); */
mywebview.loadUrl("file:///android_asset/myresource.html");
}

Vishal Sharma
- 1,051
- 2
- 8
- 15