Android 读取OTG中配置文件完成自动测试
来源:互联网 发布:最好闻的香水知乎 编辑:程序博客网 时间:2024/05/14 05:42
Config文件格式:
#版本号Version=Android_20160530#供搜索的Wifi热点名WifiAPssid=Network#Wifi最低Rssi(dBm)WifiMinRssi=-95#供搜索的蓝牙名称BTDeviceName=AZ#电池最低电压(mV)BatteryLevelL=3200#电池最高电压(mV)BatteryLevelH=4410#USB存储器最低可用容量(MB)NandFlashL=5000#USB存储器最高可用容量(MB)NandFlashH=5500
读取:
// Read CondorConfig.ini fileSharedPreferences sharedPreferences = getSharedPreferences("CondorConfig", Context.MODE_PRIVATE);Editor editor = sharedPreferences.edit();try {String encoding = "utf-8";File fileConfig = new File("/storage/usbotg/Config.ini");if (fileConfig.isFile() && fileConfig.exists()) { // 判断文件是否存在InputStreamReader read = new InputStreamReader(new FileInputStream(fileConfig), encoding);// 考虑到编码格式BufferedReader bufferedReader = new BufferedReader(read);String lineText = null;while ((lineText = bufferedReader.readLine()) != null) {if (!lineText.startsWith("#")) {if (lineText.trim().length() > 0) {String[] arrayLine = lineText.split("=");String key = arrayLine[0];String value = "";if (arrayLine.length == 2) {value = lineText.split("=")[1];}Log.v("AZ", "Key:" + key + ",Value:" + value);editor.putString(key, value);editor.commit();}}}read.close();} else {Log.e("AZ", "No such file.");}} catch (Exception e) {Log.e("AZ", "Read file catch Exception:" + e.toString());e.printStackTrace();}
0 0
- Android 读取OTG中配置文件完成自动测试
- android 直接从配置文件中读取图片
- C# 中配置文件app.config读取速度测试
- mybatis测试中读取主配置文件的两种方法
- android OTG
- android OTG
- android OTG
- android OTG
- 使用Apache-FTPClient完成文件上传和从配置文件中读取properties的使用
- Android 自动完成文本框
- android自动完成文本框
- Notepad++ 配色自动完成配置文件说明
- Android 读取Properties配置文件
- android读取properties配置文件
- android读取properties配置文件
- android读取配置文件写法
- android读取properties配置文件
- vc中读取配置文件
- Qt浅谈之十三:抓图截屏
- 用setAnimationStyle来设置popwindow显示消失的动画效果
- Android常用控件之ListView(二)
- 农村电商:虽初见成效,但任重道远
- 栈、队列和链表
- Android 读取OTG中配置文件完成自动测试
- WebView内存泄漏记录
- 242. Valid Anagram
- NSURLSession 同步请求(使用信号量)
- [C/C++11]_[初级]_[实用时间库chrono]
- c++实现的虚拟光标
- XCode7之后如何做真机测试
- 2016春季练习——DP水题
- 2016.5.30---servlet心得