Several methods of Android loading configuration files

Some configuration files in Android need to have the following types outside the code:
1. Put them in the app/src/main/assets file

		//加载配置文件
        Properties props = new Properties();
        InputStream inputStream = context.getAssets().open("config.properties");
        props.load(inputStream);
        String value = props.getProperty("create_a");

2. Put it in the app/src/main/res/raw file

		//加载配置文件
        Properties props = new Properties();
        InputStream inputStream1 = context.getResources().openRawResource(R.raw.config);
        props.load(inputStream);
        String value = props.getProperty("create_a");

Guess you like

Origin blog.csdn.net/yanwenyuan0304/article/details/115167022