Category Archives: Contacts

Using Content Resolver to List Contacts – Android

By | October 31, 2018

Here is a simple example to list contacts in android using the Content Resolver. Note : You need to have two things before accessing contacts. 1. Contacts Permission in the Android Manifest [xml]<uses-permission android:name="android.permission.READ_CONTACTS" />[/xml] 2. Ask Runtime permission from the user Code Here is our MainActivity that lists the contacts. [java] package; import android.content.ContentResolver; import… Read More »

How to Get Contact Image in Android.

By | November 12, 2012

This simple example gets the image from contacts in android. [java] private void getContactsDetails() { Cursor phones = getContentResolver().query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null); while (phones.moveToNext()) { String Name = phones .getString(phones .getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); String Number = phones .getString(phones .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); String image_uri = phones .getString(phones .getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_URI)); System.out.println("Contact1 : " + Name + ", Number " + Number + ",… Read More »

How to find your Google Plus ID

By | September 27, 2012

This is so simple 1. Go to your Google + account ( 2. Click on the Profile icon on the Left. 3. If you look at the URL in the address bar, it should look something like this: 4. The long numerical string in the URL is your Google+ ID. Here is CoderzHeaven’s from the URL above:… Read More »

How to delete a contact in android?

By | June 23, 2012

Hello all previously I have shown how to list all contacts in your phone and in another post I showed how to programatically create a contact in android. In today’s tutorial I will show you how to delete a contact in android programatically. This simple code does that. [java] public static boolean deleteContact(Context ctx, String phone, String name)… Read More »

How to add a new contact programmatically in android?

By | June 18, 2012

We all know how to add a new contact to our android devices without programming right. OK that’s a normal man’s use. But what from a programmer’s view. This is the sample java code that helps you to add contact programatically. [java] package com.coderzheaven.pack; import java.util.ArrayList; import; import android.content.ContentProviderOperation; import android.content.ContentValues; import; import android.os.Bundle; import android.provider.ContactsContract;… Read More »