4
私はWebViewを持っています。 helloworld.htmlと呼ばれるローカルHTMLファイルをロードします。それは私のdrawable-hdpiフォルダにあります。Android WebViewでローカルHTMLファイルを読み込めません。
ここが私のコードです:
webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("file:///android_asset/helloworld.html");
私は、ブラウザのエラーを取得:
The webpage at file:///android_asset/helloworld.html could not be loaded as the file requested was not found. /android_asset/helloworld.html (no such file or directory)
どうすれば解決できますか?
htmlファイルがdrawableフォルダにあるのはなぜですか? –
よろしくお願いします。私は/ assetsと呼ばれるフォルダを作りました。あなたは答えを投稿する必要があります:) –