开发者

Android : retrieve Custom properties from Deploy.properties or manifest.xml

Team,

I would like开发者_开发问答 to know, whether we can add custom configurations in Manifest or deploy properties? If yes, please provide examples.

thanks, Ramesh


Put your .properties file into the /res/raw directory

try {
    Resources resources = this.getResources();
    // Check generated R file for name oy your resource
    InputStream rawResource = resources.openRawResource(R.raw.resourceFileName);
    Properties properties = new Properties();
    properties.load(rawResource);
    System.out.println("The properties are now loaded");
    System.out.println("properties: " + properties);
} catch (NotFoundException e) {
    System.err.println("Did not find raw resource: "+e);
} catch (IOException e) {
    System.err.println("Failed to open property file");
}

Source: http://myossdevblog.blogspot.com/2010/02/reading-properties-files-on-android.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜