Android 讀取配置文件.properties


不啰嗦直接 上代碼

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.com

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM