不啰嗦直接 上代碼
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完成