Get Contact List Details Android Programmatically

Hello, all learners. Welcome to get contact list details android studio programmatically.

In this get contact list details Android Studio programmatically tutorial we will learn how to retrieve contact name, phone number, email, etc. information in Android app programmatically.

Contact based application will need to access contact details, this tutorial will guide you for this purpose.

First, check the output of get contact list details Android Studio programmatically then we will implement it.

Download Source Code

[sociallocker] Download GetContactDetailsDemonuts [/sociallocker]


Creating get contact list details android studio programmatically example step by step

Step 1: Create a new project in Android Studio.

Always create new project with Empty activity in android studio.

Step 2: Updating AndroidManifest.xml file

add required permissions between <manifest>….</manifest> tag.

Note: If you are targeting SDK version above 22 (Above Lollipop)  then you need to ask a user for granting runtime permissions. Check marshmallow runtime permission for more information.

Final code for AndroidManifest.xml file

Step 3: Updating activity_main.xml file

We will make user interface for getting name, phone number and email address.

Three textviews are used for this purpose.

Copy and paste below source code in activity_main.xml file

Step 4: Preparing class

Add following source code in class

Step 5: Description of

Following source code will open contact list on button click.

After clicking on contact list item, onActivityResult() method is called.

Below line will get name of contact

Below source code will check whether contact has a phone number or not.

If contact has phone number, then it will be got by following

Following source code will take the Email address.

Then finally, all text are set in respected textviews

Kotlin Version

Kotlin version of this tutorial is at here: Contact List Details Android Kotlin

So all for get contact list details android studio programmatically example tutorial. Thank you.

Hardik Parsania

I am mobile app developer. I am always passionate about solving complex and real world problems.I have developed many apps with great interest and superior logical skills.

You may also like...

4 Responses

  1. Alpesh Savaliya says:

    i got problem,
    when i open contact list, list is open successfully, but when i press back without click on contact, app got crash

  2. VK says:

    Hi, this code was so help full for me, i need some more help from u, i need to select specific number of a person, for eg: i have saved someones name with two or more numbers so how could i select specific number. if u can help me, let me know, thank you.

    • Hardik Parsania says:

      I also need to dig out about selecting specific number.
      I will make separate tutorial on this topic in near future.

Leave a Reply

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