阅读更多 ios的配置文件是写在.plist里。
那么,如何从android读取.plist文件内容呢?
1.需要导入dd-plist.jar
2.读取.plist文件


config.plist
<?xml version="1.0" encoding="UTF-8"?>version1nethttptimeout30URLhttp://xxx.xxx.xxx.xxxcertifyUserURLhttp://xxx.xxx.xxx.xxx/certifyUserencodingutf-8


逻辑方法
URL url = null;InputStream in = null;in = XmlUtil.getFileInputStream( "config/config.plist", context );NSDictionary configSetting = (NSDictionary) PropertyListParser.parse( in );NSDictionary configNet = (NSDictionary) configSetting.objectForKey( "net" );NSDictionary configHttp = (NSDictionary) configNet.objectForKey( "http" );String strUrl = configHttp.objectForKey( "URL" ).toString();url = new URL( strUrl );


XmlUtil中的方法
public static InputStream getFileInputStream( String fileName, Context context ) {    AssetManager am = context.getResources().getAssets();    InputStream in = null;    try {        in = am.open( fileName );    } catch ( IOException e ) {        // TODO Auto-generated catch block        e.printStackTrace();    }    return in;}

更多相关文章

  1. 浅谈Java中Collections.sort对List排序的两种方法
  2. NPM 和webpack 的基础使用
  3. Python list sort方法的具体使用
  4. 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
  5. python list.sort()根据多个关键字排序的方法实现
  6. 在Android中把SQLite的数据库文件存储在SD卡中【转】
  7. android studio快捷键 for mac
  8. Android用HTTP下载报错“android.os.StrictMode$AndroidBlockGua
  9. android常见技巧---Android按返回键退出程序但不销毁

随机推荐

  1. andriod 4.0以上版本不调用onConfigratio
  2. Android(安卓)抽象回调函数以及接口回调
  3. coredump在Android上的应用
  4. Android(安卓)虚拟按键驱动实现
  5. android 信息(mms)的故事(五)-- 发彩信
  6. android支持有线网--网络上看到
  7. Android(安卓)源代码编后的目录分析
  8. android中实现返回首页功能
  9. android 存储简要分析
  10. Haisi3716C (海思)源代码 编译并烧写