android 获取通讯录记录列表

**
         * 获取通讯录记录列表
         * @return
         */
        public ArrayList<Contactor> getList(){
                Log.i(TAG, "getList");
                
                ArrayList<Contactor> list = new ArrayList<Contactor>();
                
                String[] columns = new String[] {Phones.NAME, Phones.NUMBER};
                
                Cursor cursor = context.getContentResolver().query(Phones.CONTENT_URI, columns, null, null, People.DEFAULT_SORT_ORDER);
                while (cursor.moveToNext()) {
                        Contactor bean = new Contactor();
                        bean.setName(cursor.getString(0));
                        bean.setPhone(cursor.getString(1));
                        list.add(bean);
                        
                        Log.d(TAG, "name:" + bean.getName());
                        Log.d(TAG, "phone:" + bean.getPhone());
                }
                cursor.close();
                
                return list;
        }

posted on 2010-08-12 23:24 lbeing 阅读(1201) 评论(0) 编辑 收藏

公告

昵称:lbeing
园龄:1年6个月
粉丝:1
关注:1

导航

<2010年8月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

统计

  • 随笔 - 10
  • 文章 - 2
  • 评论 - 2
  • 引用 - 0

搜索

 
 

常用链接

随笔档案(10)

最新评论

阅读排行榜

评论排行榜

推荐排行榜