Read Contacts From Device

Read Contacts from device


This is a sample activity which shows How to read the contacts of phone and display them in your application. Last topic published on this forum is Detect USB connection.

Underlying Algorithm:

Basic description of algorithm in step by step form:
1.) Create a Project ReadContacts.
2.) Put the following code snippet in res/layout/main.xml :




3.) Add the following permission in AndroidManifest.xml :




4.) Import the following packages in activity:




5.) Add some contacts in device/emulator.
6.) Run the Application.

Steps to Create:

1.) Open Eclipse. Use the New Project Wizard and select Android Project Give the respective project name i.e. ReadContacts. Enter following information:
Project name: ReadContacts
Build Target: Android APIs2.1
Application name: ReadContacts
Package name: ReadContacts
Create Activity: ReadContacts

On Clicking Finish ReadContacts code structure is generated with the necessary Android Packages being imported along with ReadContacts class will look like following:




Output –The final output:

Comments 11

  1. How can i loop and change all contacts accordingly… got +600 contacts, and providers here were so smart to add a new digit, but not providing a solution to change those numbers

Leave a Reply

Your email address will not be published. Required fields are marked *