摘要: 1. 示例代码需要的读写联系人的权限 读联系人代码public void click(View view) { ContentResolver resolver = getContentResolver(); // raw_contact 表的uri Uri uri = Uri.parse("content://com.android.contacts/raw_contacts"); // data 表的uri Uri dataUri = Uri.parse("content://com.android.contacts/data"); Cursor c 阅读全文
posted @ 2014-03-26 16:35 今晚打酱油_ 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 1. 实现原理图2. 示例代码 (暂时有个问题,短信观察者 收到一条短信时 onchange方法会执行两次, 解决方法为:每次监听到变化的时候就去取最新短信的id,跟上次取的比较,如果一样的就不做处理,如果不一样,就该干嘛干嘛)MainActivity.javapublic class MainActivity extends Activity { public static final String TAG = "MainActivity"; @Override protected void onCreate(Bundle savedInstanceState) { su 阅读全文
posted @ 2014-03-26 10:26 今晚打酱油_ 阅读(532) 评论(0) 推荐(0) 编辑
摘要: 1. 读写短信 示例代码均需要先获得读写短信的权限 读取短信代码public void click(View view){ //1.利用内容提供者 中间人 获取用户的短信数据. ContentResolver resolver = getContentResolver(); Uri uri = Uri.parse("content://sms/"); //根据分析 代表的是所有的短信的路径 Cursor cursor = resolver.query(uri, new String[]{"address","date","b 阅读全文
posted @ 2014-03-26 09:24 今晚打酱油_ 阅读(1122) 评论(0) 推荐(0) 编辑
摘要: http://os.51cto.com/art/200905/126051.htm用adb直接查看log: adb logcat 清除之前的log: adb logcat -c 加过滤查看log(查看错误信息,异常就在这里): adb logcat -s *:E将log输出到sdcard: adb logcat -f /sdcard/xxx.loglogcat是Android中一个命令行工具,可以用于得到程序的log信息。logcat使用方法如下所示:logcat [options] [filterspecs]logcat的选项包括:-s 设置过滤器,例如指定 "*:s"- 阅读全文
posted @ 2014-03-26 08:34 今晚打酱油_ 阅读(403) 评论(0) 推荐(0) 编辑