zoukankan      html  css  js  c++  java
  • Android下用Properties保存程序配置

    读写函数分别例如以下:


    orz,是不是发现什么了?对了,这两个函数与Android一点关系都没有嘛。。
    所以它们一样能够在其它标准的java程序中被使用
    在Android中,比起用纯字符串读写并自行解析,或是用xml来保存配置,
    Properties显得更简单和直观,由于自行解析须要大量代码,而xml的操作又远不及Properties方便

    用法例如以下:
    写入配置:

    读取配置:

    注:也能够用Context的openFileInput和openFileOutput方法来读写文件
    此时文件将被保存在 /data/data/package_name/files下,并交由系统统一管理
    用此方法读写文件时,不能为文件指定详细路径。
  • 相关阅读:
    Sprinig.net 双向绑定 Bidirectional data binding and data model management 和 UpdatePanel
    Memcached是什么
    Spring.net 网络示例 codeproject
    jquery.modalbox.show 插件
    UVA 639 Don't Get Rooked
    UVA 539 The Settlers of Catan
    UVA 301 Transportation
    UVA 331 Mapping the Swaps
    UVA 216 Getting in Line
    UVA 10344 23 out of 5
  • 原文地址:https://www.cnblogs.com/gcczhongduan/p/4296725.html
Copyright © 2011-2022 走看看