AndroidStudio_android中实现对properties文件的读写操作_不把properties文件放在assets文件夹中_支持读写---Android原生开发工作笔记238
发布日期:2021-06-29 17:54:18 浏览次数:3 分类:技术文章

本文共 716 字,大约阅读时间需要 2 分钟。

   这个东西还挺麻烦,因为是android中,我们一般把文件放到assets文件夹中去,但是实际上,这个raw文件夹和assets文件夹

是只读的,对,就是只读的只能读取,不能写入,所以一定要把文件写入到:

比如:

String configPath = "/data/data/com.baidu.idl.face.demo/audiofile/config.properties";

这样的位置.

不能用下面比如:

getApplicationContext().getAssets().open("config.properties")

 这样的方法去读,这个方法,读取的是assets文件夹中的文件,这样的话,这个文件是只能读取的,如果你不需要写入的话,可以这样用.

 

 

下面是我在android中使用的properties文件的读写操作,可以复制过去直接用.

比如我这个properties文件中的内容:

#check_type = 1 //体重#check_type = 2  //血压#check_type = 3 //三合一#check_type = 4 //肺呼吸#check_type = 5 //握力球#check_type = 6 //心电仪5#check_type = 7 //查看排名#check_type = 8 //查看我的信息check_type = 8#绑定设备的mac地址#mac_address = ED:67:37:5C:CF:EM //1.青牛体重秤#mac_address = A4:C1:38:A1:15:FM //2.乐康血压计#mac_address = 90:E2:02:A1:AE:4M

转载地址:https://credream.blog.csdn.net/article/details/116928492 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:弹框没反应使用Looper解决_the caller should invoke Looper.prepare() and Looper.loop()---Android原生开发工作笔记239
下一篇:AndroidStudio_java.util.ConcurrentModificationException---Android原生开发工作笔记237

发表评论

最新留言

不错!
[***.144.177.141]2024年04月10日 09时49分47秒