--ADVERTISEMENT--

Contact number/name can be read with various methods in android application. In this tutorial, you will learn to open contact number list and display a selected contact name in your android application. in the same way you can also display friends name with contact number from contact list.

In android, we get contact list using ContactsContract. Its provides bridge between contact provider and your android application. I have already posted different post like How to Get Registered Email Address Programmatically in Android, How to Get the Phone Number Programmatically in Android and you can find more post like this.

To open contact number list and display name in android, you have to add permission in your application AndroidManifest.xml file. Add following permission in AndroidManifest.xml file.


Related:
Turn ON and OFF WiFi Connection Programmatically in Android
How to Launch Other Application From Your Android App Programmatically
How to Pick an Image From SD Card Gallery and Display in Android App

Android Example: How to Open Contact Number List and Display Name in Android


Following is the all necessary code of java activity file and XML layout file.

XML Layout File

Following is the content of XMl layout file.
res/layout/open_contact_number_list.xml

Java Activity File


Following is the modified content of OpenContactNumberList.java file.
src/OpenContactNumberList.java

Strings.xml File

res/values/strings.xml


Now, run your How to Open Contact Number List and Display Name in Android application and click Pick A Contact List button to open default contact application then select a contact name, you will see selected contact name inside your application.

Post a Comment

Powered by Blogger.