Load WebView with .html file linked to /assets fol

2019-07-31 06:43发布

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 folder to real file in external folder on disk.)

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

2条回答
我欲成王,谁敢阻挡
2楼-- · 2019-07-31 07:16

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.

查看更多
何必那么认真
3楼-- · 2019-07-31 07:18

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.

查看更多
登录 后发表回答