我是CodenameOne的新手,很棒的平台。
我看到一个名为"codenameone_settings.properties“的文件,我添加了一个名为"myapi”、"http://localhost:3000“的新属性
我怎样才能进入这个财产?我试过了
Preferences.set("myapi", "nono")当我这么做时:
System.out.println(Preferences.set("myapi", "nono"));我得到了"nono“
发布于 2016-06-17 10:08:50
"codenameone_settings.properties“是应用程序无法访问的项目配置文件。如果您需要/希望在应用程序中使用属性文件,请将自己的属性文件添加到项目src/文件夹中,并从代码中加载它。
例如:
//place the App_settings.properties under the src/ dir
Properties conf = new Properties();
conf.load(Display.getInstance().getResourceAsStream(getClass(), "/App_settings.properties"));https://stackoverflow.com/questions/37873070
复制相似问题