Android 讀取配置文件.properties

不囉嗦直接 上代碼spa

Properties properties = new Properties();
try {
            InputStream in=context.getAssets().open("test.properties");
            properties.load(in);
            in.close();
}catch (IOException e){
  //  ...
    return;
}

String host = properties.getProperty("HOST");

properties 中添加  HOST =https://www.baidu.comcode

properties文件放在 assets文件夾中 OK完成blog

相關文章
相關標籤/搜索