1. Put your config file inside lib directory populated on aar file.
2. Using:
InputStream in=getClass().getClassLoader().getResourceAsStream("Test.properties");
which will load the property file into memory.
3. for instance:
public String testResourceReader() {
Properties p=new Properties();
InputStream in=getClass().getClassLoader().getResourceAsStream("Test.properties");
try {
p.load(in);
} catch (IOException e) {
e.printStackTrace();
}
return p.toString();
}
Result:
<ns:testResourceReaderResponse>
<ns:return>{name=test name, file=file1}</ns:return>
</ns:testResourceReaderResponse>
没有评论:
发表评论