한국어

스마트폰앱

온누리070 플레이스토어 다운로드
    acrobits softphone
     온누리 070 카카오 프러스 친구추가온누리 070 카카오 프러스 친구추가친추
     카카오톡 채팅 상담 카카오톡 채팅 상담카톡
    
     라인상담
     라인으로 공유

     페북공유

   ◎위챗 : speedseoul


  
     PAYPAL
     
     PRICE
     

pixel.gif

    before pay call 0088 from app


http://micropilot.tistory.com/entry/Android-Contacts-API-2-example-1

 

package my.android.test; import java.util.*; import android.app.*; import android.content.*; import android.database.*; import android.os.Bundle; import android.provider.*; import android.provider.ContactsContract.CommonDataKinds.*; import android.widget.*; public class GetAllContacts extends Activity { ListView lvItem; String displayName=""; ArrayList<String> contactlist = new ArrayList<String>(); ArrayAdapter<String> itemAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); lvItem = (ListView)this.findViewById(R.id.lvitems); readContacts(); itemAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,contactlist); lvItem.setAdapter(itemAdapter); } private void readContacts() { ContentResolver cr = getContentResolver(); Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); while (cursor.moveToNext()) { displayName = ""; displayName = cursor .getString(cursor .getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); String id = cursor.getString(cursor .getColumnIndex(ContactsContract.Contacts._ID)); String holder = ""; holder = holder + displayName; /* Phone Number and Type */ ArrayList<String> phoneList = new ArrayList<String>(); if (Integer .parseInt(cursor.getString(cursor .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) { Cursor pCur = cr.query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[] { id }, null); while (pCur.moveToNext()) { int phoneType = pCur .getInt(pCur .getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE)); String pnum = pCur.getString(pCur .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); switch (phoneType) { case ContactsContract.CommonDataKinds.Phone.TYPE_HOME: phoneList.add(", Home, "+pnum); break; case ContactsContract.CommonDataKinds.Phone.TYPE_WORK: phoneList.add(", Work, "+pnum); break; case ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE: phoneList.add(", Mobile, "+pnum); break; case ContactsContract.CommonDataKinds.Phone.TYPE_OTHER: phoneList.add(", Other, "+pnum); break; } } // end of while pCur.close(); } // end of if /* Email */ Cursor emails = cr.query(Email.CONTENT_URI, null, Email.CONTACT_ID + " = " + id, null, null); ArrayList<String> emailList = new ArrayList<String>(); while (emails.moveToNext()) { int emailType = emails .getInt(emails .getColumnIndex(ContactsContract.CommonDataKinds.Email.TYPE)); String email = emails.getString(emails .getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)); switch (emailType) { case ContactsContract.CommonDataKinds.Email.TYPE_HOME: emailList.add(", Home, "+email); break; case ContactsContract.CommonDataKinds.Email.TYPE_WORK: emailList.add(", Work, "+email); break; case ContactsContract.CommonDataKinds.Email.TYPE_MOBILE: emailList.add(", Mobile, "+email); break; case ContactsContract.CommonDataKinds.Email.TYPE_OTHER: emailList.add(", Other, "+email); break; } } emails.close(); /* Requirements for Abhilash in India */ if(phoneList.size()>=emailList.size()) { for(int i=0;i<phoneList.size();i++) { holder = displayName + phoneList.get(i); try{ holder = holder + emailList.get(i); }catch(Exception ex){ holder = holder + ", , "; } contactlist.add(holder); } }else { for(int i=0;i<emailList.size();i++) { try{ holder = displayName+ phoneList.get(i); }catch(Exception ex){ holder = holder + ", , "; } holder = holder + emailList.get(i); contactlist.add(holder); } } } cursor.close(); } }

조회 수 :
22937
등록일 :
2012.09.30
19:58:31 (*.160.42.233)
엮인글 :
http://webs.co.kr/index.php?document_srl=11869&act=trackback&key=e62
게시글 주소 :
http://webs.co.kr/index.php?document_srl=11869
List of Articles
번호 제목 글쓴이 날짜 조회 수
36 Rotary Dialer clip art admin 2013-04-20 24226
35 Java 프로그램 실행화일 만들기 : Launch4j admin 2013-02-21 20023
34 java network programming source code, learning socket programming admin 2012-12-04 17658
33 2X Client Configuration | Android Remote Desktop 안드로이드 PC 리모트 데스크탑 admin 2012-12-02 19083
32 WIFI 3G 인터넷 연결 실시간 체크 소스코드 Broadcast Receiver 사용 (Adnroid) admin 2012-10-31 29884
31 통신사별 와이파이 비밀번호 admin 2012-10-31 34903
30 팁, wifi 패스워드 모음집 password admin 2012-10-21 17851
29 Android User Session Management using Shared Preferences admin 2012-10-16 51341
28 Unicode Tables v4 admin 2012-10-16 49679
27 HTML Codes admin 2012-10-16 17130
26 IBM Scan Codes EBCDIC Codes admin 2012-10-16 18790
25 ASCII Table and Description admin 2012-10-16 18737
24 How to Show Alert Dialog in Android (간단하고 쉬운설명) admin 2012-10-15 39900
23 How to read contacts on Android 2.0 admin 2012-10-14 20632
22 WIFI 3G 인터넷 연결 체크 소스코드 직접 사용한 코드 android admin 2012-10-14 23736
21 Android Detect Internet Connection Status admin 2012-10-12 28721
20 JAVA + SSL (server and client examples) admin 2012-10-07 31045
19 Querying The Android Contact Database admin 2012-09-30 18789
18 Manage Contacts android admin 2012-09-30 19721
» Android Contacts API 2 example admin 2012-09-30 22937
16 Android 2.0 주소록 동기화 기능 admin 2012-09-30 66145
15 안드로이드용 앱 개발 마켓등록 까지 해본거 샘플 무료국제전화 앱 FreeDialer admin 2012-09-27 23253
14 아이폰 IPhone 앱 개발 기본 admin 2012-09-27 19501
13 [안드로이드/개발] Intent admin 2012-09-23 36044
12 안드로이드 타이머 절적한 설명과 간단한소스코드 등 안드로이드 프로그램 설명 깔끔 admin 2012-09-23 48948
11 google voice source code admin 2012-09-22 18159
10 [안드로이드] 서버/클라이언트 소켓(Socket) 통신하기 admin 2012-09-20 38957
9 FreeDial 무료국제전화는 프리미엄 국제전화 다이렉트 회선사용 admin 2012-09-20 19807
8 Android SQlite 사용 admin 2012-09-04 21257
7 안드로이드마켓에 앱 등록하는 순서 admin 2012-08-19 64018