I am using this code to search for a contact
String[] projection = new String[]
{
Contacts.People.NAME,
Contacts.People.NUMBER
};
Cursor c = this.getContentResolver().query(Contacts.People.CONTENT_URI, projection, null, null, Contacts.People.NAME + " ASC");
c.moveToFirst();
int nameCol = c.getColumnIndex(Contacts.People.NAME);
int numCol = c.getColumnIndex(Contacts.People.NUMBER);
int nContacts = c.getCount();
String result ="";
do
{
String name = c.getString(nameCol);
String number = c.getString(numCol);
if (name.equals("XXXX")){
result= number;
}
} while(c.moveToNext());
but I am getting a nullPointerExeception on name.equals("XXXX") what would be the problem