从android 里面读取配置文件
private Properties loadProperties() {
Properties props = new Properties();
try {
int id = context.getResources().getIdentifier("and", "raw",
context.getPackageName());
props.load(context.getResources().openRawResource(id));
} catch (Exception e) {
e.prinkstack();
}
return props;
}
props = loadProperties();
apiKey = props.getProperty("key", "");
xmppHost = props.getProperty("host", "127.0.0.1");
xmppPort = props.getProperty("port", "5222");
在raw里面加入and.properties文件,内容如下
key=1234567890
host=192.168.0.121
port=5222