2011-06-20 18 views
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) 

どうすれば解決できますか?

+0

htmlファイルがdrawableフォルダにあるのはなぜですか? –

+0

よろしくお願いします。私は/ assetsと呼ばれるフォルダを作りました。あなたは答えを投稿する必要があります:) –

答えて

12

HTMLファイルをassetsフォルダに置きます。

関連する問題