public String getAndroidpnProperties(String key, String defaultValue) {
if (loadProperties() == null) {
return defaultValue;
}
return loadProperties().getProperty(key, defaultValue);
}
protected Properties loadProperties() {
Properties props = new Properties();
try {
int id = getApplicationContext().getResources().getIdentifier("androidpn", "raw", getApplicationContext().getPackageName());
props.load(getApplicationContext().getResources().openRawResource(id));
} catch (Exception e) {
}
return props;
}android获取raw文件内容
最新推荐文章于 2021-05-27 13:13:31 发布
本文介绍了一个用于从Android应用的资源文件中读取配置属性的方法。该方法首先尝试加载一个名为'androidpn'的资源文件,如果成功,则通过提供的键获取对应的属性值;如果加载失败或者找不到指定的键,则返回默认值。
1567

被折叠的 条评论
为什么被折叠?



