[英]Configuration properties file in Android project
如何在Android项目中放置配置文件? 目前,我在res目录中的目录为: res / config / configuration.properties
and want to access it as :
properties = new Properties();
properties.load(getClass().getResourceAsStream("config/configuration.properties"));
它不起作用:输入流为空
您可以将其作为资产/configuration.properties放置在资产目录中
范例程式码
try {
InputStream is = context.getAssets().open("configuration.properties");
Properties props = new Properties();
props.load(is);
String value = props.getProperty("key", "");
is.close();
} catch (Exception e) {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.