我正在使用此代码搜索联系人
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());
但是我在name.equals(“XXXX”)上得到一个nullPointerExeception会出现什么问题