开发者

Load WebView with .html file linked to /assets folder

I need to load .html file into WebView but this file is situated in external folder on disk. I cannot copy file into /assets folder under my android project. But i can create a link to this file in Eclipse.

The question is how can i load this linked file into WebView?

I tried to load it with webView.loadUrl("file:///android_asset/myFile.html") but it did work. WebView cannot find 'myFile.html' in '/assests' folder. ('myFile.html' link in /assests 开发者_StackOverflow中文版folder to real file in external folder on disk.)

Please give any idea!!!! Thanks in advance!


If you are on OS X or Linux, try creating a symlink into your project assets/ for the file in question. I doubt that an Eclipse link will be sufficient, as packaging assets into the APK is not Eclipse's job, and the Android tools invoked by Eclipse may not know about Eclipse links.


For windows use this command mklink /D link-folder-name target-folder. The eclipse/android work fine with this link and your apk will have all the linked resources.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜