<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    package yinger.firewall.util;

    import java.util.ArrayList;
    import java.util.HashMap;

    import android.content.ContentResolver;
    import android.content.Context;
    import android.database.Cursor;
    import android.provider.ContactsContract;
    import android.provider.ContactsContract.PhoneLookup;

    /**
     * ReadContactsUtil
     * 
     * 
    @author Ying_er
     * @Email melody.crazycoding@gmail.com
     * @time 2011/03/30 11:57:23
     * 
    @version 1.00
     
    */
    public final class MyReadContactsUtil {
        
    /**
         * 
    @return contacts list
         
    */
        
    public static ArrayList getContacts(Context context) {
            ArrayList
    <HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
            String number 
    = "";
            ContentResolver cr 
    = context.getContentResolver();// 得到一個(gè)ContentResolver對(duì)象
            
    // 得到一個(gè)游標(biāo)查詢(xún)對(duì)象
            Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null,
                    
    nullnullnull);
            
    while (cursor.moveToNext()) {
                
    // 獲取聯(lián)系人的名字的索引
                int nameFieldColumnIndex = cursor
                        .getColumnIndex(PhoneLookup.DISPLAY_NAME);
                
    // 獲取聯(lián)系人的名字
                String contact = cursor.getString(nameFieldColumnIndex);
                Cursor target 
    = context.getContentResolver().query(
                        ContactsContract.Contacts.CONTENT_URI, 
    nullnullnull,
                        
    null);
                target.moveToFirst();
                
    // 得到聯(lián)系人的ID
                String contentId = cursor.getString(target
                        .getColumnIndex(ContactsContract.Contacts._ID));
                String isPnone 
    = cursor
                        .getString(cursor
                                .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
                
    if (Integer.parseInt(isPnone) > 0) {
                    Cursor phone 
    = context.getContentResolver().query(
                            ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                            
    null,
                            ContactsContract.CommonDataKinds.Phone.CONTACT_ID 
    + "="
                                    
    + contentId, nullnull);
                    
    while (phone.moveToNext()) {
                        
    // 得到聯(lián)系人電話(huà)
                        number = phone
                                .getString(phone
                                        .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                        HashMap
    <String, String> map = new HashMap<String, String>();
                        map.put(
    "number", number);
                        map.put(
    "name", contact);
                        number 
    = "";
                        list.add(map);
                    }
                    phone.close();
                }
            }
            cursor.close();
            
    return list;
        }
    }
    posted on 2011-05-26 10:05 Ying-er 閱讀(789) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Android
    主站蜘蛛池模板: 亚洲精品无码久久久久秋霞| 亚洲人成网7777777国产| 日韩精品福利片午夜免费观着| 97人妻无码一区二区精品免费| 精品久久久久成人码免费动漫 | 久久精品国产亚洲AV无码偷窥| 久久亚洲春色中文字幕久久久 | 一个人免费播放在线视频看片| 免费在线中文日本| 毛片基地看看成人免费| 中文字幕免费观看| www.亚洲色图| 亚洲一区在线免费观看| 一区二区三区在线免费| 国产亚洲情侣一区二区无| 在线精品亚洲一区二区| 久久久精品午夜免费不卡| 久久精品亚洲综合专区| 黄色三级三级三级免费看| 成人福利免费视频| 亚洲国产av玩弄放荡人妇| 99re6在线视频精品免费下载| 亚洲综合精品网站在线观看| 亚洲日本VA午夜在线电影| 国产一级淫片a免费播放口之| 亚洲精品456在线播放| 中文字幕无线码免费人妻| 日韩午夜免费视频| 亚洲视频一区在线| 国产一精品一AV一免费| 亚洲精品综合久久中文字幕| 在线观看无码的免费网站| 亚洲国产精品成人久久久| 91老湿机福利免费体验| 亚洲人片在线观看天堂无码| 亚洲综合区小说区激情区| 国产成人精品免费视| 亚洲国产日产无码精品| 日本成年免费网站| 成在线人直播免费视频| 亚洲?V乱码久久精品蜜桃|