开发者

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

开发者 https://www.devze.com 2022-12-29 00:37 出处:网络
Team, I would like开发者_开发问答 to know, whether we can add custom configurations in Manifest or deploy properties? If yes, please provide examples.

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

精彩评论

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