Resources and Codename One

不羁岁月 提交于 2019-12-06 15:20:46
tizbn

There are several ways to do this. If you can package every individual file into a single file you can use something like this:

  1. put the test.html in default package
  2. create WebBrowser webBrowser = new WebBrowser(); and add to your form
  3. webBrowser.setUrl("jar:///test.html")

If you need a complex HTML/CSS/JavaScript hierarchy then you can place all your files into the root html package (src/html). Then open an HTML file from within the html package using code like this:

try {
    browserComponent.setURLHierarchy("/htmlFile.html");
} catch(IOException err) {
    ...
}

Notice that the path is relative to the html directory and starts with / but inside the HTML files you should use relative (not absolute) paths.

The build server will tar the entire content of that package and add an html.tar file into the native package. This tar is seamlessly extracted on the device when you actually need the resources and only with new application versions (not on every launch).

From the manual.

As a sidenote the resource files do support adding arbitrary data files but the hierarchies solution is a better approach.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!