JAVA android 获取assets文件夹中的properties文件 并从中获取数据
2018-03-01 14:59
639 查看
class PropertiesUtils { private static Properties properties = null; private static void readProperties() { try { InputStream in = PropertiesUtils.class.getResourceAsStream("/assets/sdk_param_config.properties"); properties = new Properties(); properties.load(in); } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException e) { Log.e("PropertiesUtils", "get nothing"); e.printStackTrace(); } } public static Properties getProperties() { if (properties == null) { readProperties(); } return properties; } }
文件存放于主程序里
获取数据
String a = properties.getProperty("a");
相关文章推荐
- Java 简单解决springmvc获取properties文件里面中文内容出现论码问题(我遇到的问题是数据提交检验时返回的错误提示出现乱码)
- java解析压缩文件.zip,获取文件夹下的数据
- Android如何读取Raw及assets文件夹中文件的数据信息
- java-获取.csv文件里的数据,并且获取文件夹下所含有对象的个数
- Android获取assets文件夹下的json数据,并解析!
- Android中以数据流的形式获取assets文件夹中文件的内容
- Android获取assets文件夹中的数据并写入SD卡示例
- Android java程序获取assets资产文件
- Android工程文件下assets文件夹与res文件夹的区别
- Android中数据文件解析(Json解析【从服务器端获取数据并且解析,显示在客户端上面】)
- Android: 如何打开assets or raw文件夹下的数据库文件
- Android创建文件夹及文件并写入数据
- Android中资源文件夹res/raw和assets的使用(续)——分割文件以及合并文件
- java 遍历文件夹内大文件数据
- JAVA获取/删除文件夹及文件夹下所有文件
- Android中数据文件解析(Json解析【从服务器端获取数据并且解析,显示在客户端上面】)
- Android中资源文件夹res/raw和assets的使用(续)——分割文件以及合并文件
- java中如何获取远程计算机post提交的数据并把这些数据写入本地的txt文件中
- java 获取文件夹大小,文件大小,文件个数
- java 用properties文件配置spring数据源,用spring的JdbcTemplate的queryForList查数据