Android获取Contact Number的例子(2.0系统以前的获取方式)
来源:互联网 发布:mac onenote 文字识别 编辑:程序博客网 时间:2024/06/06 21:49
- http://www.blogjava.net/caizh2009/archive/2010/12/17/341010.html
- String[] projection = new String[] {
- People._ID,
- People.NAME,
- People.NUMBER,
- };
- // Get the base URI for People table in Contacts content provider.
- // which is: content://contacts/people/
- Uri contactUri = People.CONTENT_URI;
- // Best way to retrieve a query; returns a managed query.
- Cursor peopleCursor = managedQuery (contactUri,
- projection, //Which columns to return.
- null, // WHERE clause--we won't specify.
- null, // Selection Args??
- People.DEFAULT_SORT_ORDER); // Order-by name
- // go to the beginning of the list
- peopleCursor.moveToFirst();
- // So, here we have a contact. We need to get the contact ID (_id) then
- // build the Uri to get the phones section of that user's record
- // which is a subdirectory of a contact record
- long personId = peopleCursor.getLong(peopleCursor.getColumnIndex("_id"));
- Uri personUri = ContentUris.withAppendedId(contactUri, personId );
- // So now the URL looks like: content://contacts/people/_id(where the actual id of the record is here)
- Uri phoneUri=
- Uri.withAppendedPath(personUri, Contacts.People.Phones.CONTENT_DIRECTORY);
- // Now the URL looks like: content://contacts/people/_id/phones (where phones is literally "phones")
- // Now get all the phone numbers for this contact
- Cursor phonesCursor = managedQuery(phoneUri,
- null,
- null,
- null,
- Phones.DEFAULT_SORT_ORDER);
- // We now have a cursor for all the phone numbers for that User ID
- // go to the beginning of the phone list.
- phonesCursor.moveToFirst();
0 0
- Android获取Contact Number的例子(2.0系统以前的获取方式)
- 获取Contact的具体内容
- Android apk 获取系统权限的方式
- 从outlook2003 获取contact list, 并添加新的contact
- iOS :获取通讯录 新的contact框架
- iOS :获取通讯录 新的contact框架
- 小例子--获取格式化的系统时间
- linux 获取远程系统时间的例子
- Android--获取系统时间的几种方式
- Android 获取系统时间的三种方式
- Android--获取系统时间的几种方式
- Android--获取系统时间的几种方式
- Android获取系统时间的几种方式
- Android--获取系统时间的几种方式
- Android获取系统时间的几种方式
- android--获取系统时间的几种方式
- Android--获取系统时间的几种方式
- 笔记26 | Android获取系统时间的几种种方式
- Linux系统中 chown和chmod 命令的区别:
- mysql 5.6.16 win7 32位免安装版配置
- treeView的技巧
- java学习日记之--单模设计模式(毕向东基础视频)
- webservice和soap原理
- Android获取Contact Number的例子(2.0系统以前的获取方式)
- websphere6.1开发、部署、远程调用EJB2.0
- VMware中Linux无法全屏的问题
- 为程序添加版本自动更新功能(转+详细分析)
- Number of 1s
- 构建自定义组件
- uva 10061: How many zero's and how many digits?
- LINUX中oracle10g安装
- Android 核心分析 之六 -----IPC框架分析 Binder,Service,Service manager