测试相关、sdk卡读取

测试:
monkey 猴子

测试整个系统 adb shell monkey -v 1000 (-v 指定模拟测试的事件数量)

测试某个程序 adb shell monkey -p <程序的包名> -v 事件的数量

android下Junit测试配置信息:
在AndroidManifest.xml中配置一下信息

1. 在manifest节点下配置一下信息.
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.itheima27.junittestdemo" >
</instrumentation>

2. 在application节点下配置以下信息.
<uses-library android:name="android.test.runner" />


Android下数据存储:

手机内部存储:
/data/data/com.itheima27.qqlogin

路径相关:
// 存放一些应用程序配置的信息.
this.getFilesDir(); // /data/data/当前应用程序的包名/files

// 存放应用程序缓存文件(不能影响应用程序运行的数据.)
this.getCacheDir(); // /data/data/包名/cache/


存储卡的路径:
Environment.getExternalStorageDirectory(); /mnt/sdcard/


SharedPreference使用:

// /data/data/包名/shared_prefs/itheima27.txt
context.getSharedPreferences("itheima27.txt", context.MODE_PRIVATE); // 指定访问的模式为:私有模式.

存数据时:
1. 获得SharedPreferences对象 context.getSharedPreferences("itheima27.txt", context.MODE_PRIVATE);
2. 获得编辑器对象 Editor e = sp.edit();
3. 使用Editor对象存储数据 editor.putString
4. 存储完数据记住commit

去数据时:
1.获得SharedPreferences对象 context.getSharedPreferences("itheima27.txt", context.MODE_PRIVATE);
2.根据key值取相应的value值 sp.getString(key, defaultValue);

android下权限:
私有文件,
可读文件,
可写文件,
可读可写文件.


Xml文件:
1.序列化xml
2.解析xml

原文地址:https://www.cnblogs.com/friends-wf/p/4497661.html