今天在Android studio中使用properties配置文件时,遇到了一个问题我在main/assets/下建了一个.properties文件并指定了键值对(例如:hh=你好啊)然后读取配置文件
String url = null; Properties properties = new Properties();
try { properties.load(c.getAssets().open("message.properties")); url = properties.getProperty(s); } catch (Exception e) { e.printStackTrace(); }
在修改.properties文件编码格式前得到的结果是乱码的,通过网上查找找到了解决的办法(连接:http://blog.csdn.net/gc_gongchao/article/details/48266143)